jQuery 手风琴列表中的倾斜元素?

发布于 2024-08-17 07:56:33 字数 476 浏览 4 评论 0原文

我想使用类似 jQuery 的手风琴菜单之类的东西,但要让触发的元素成角度。我猜这是不可能的,但我想看看是否有人尝试过。

一些不太理想的想法:

  1. 采用老式方法并使用图像映射。不过,我已经很多年没有使用过图像映射了,所以需要进行一些测试来看看它是否可行。
  2. 为每个导航元素使用多个目标区域,并将它们放置在交错布局中。虽然很老套而且臃肿。
  3. 使用精美浏览器的旋转功能。这实际上看起来并不算太糟糕,但显然对于大多数用户来说是看不到的。也不确定这将如何影响内容领域 - 但可以探索。

如果需要任何说明,请告诉我。

这是这个概念的草图: 概念草图 http://img158.yfrog.com/img158/3122/slgu.jpg< /a>

I'd like to use something like jQuery's accordion menu, but have the triggered elements be angled. I'm guessing this isn't possible, but thought I'd see if anyone has tried it before.

A few less than ideal ideas:

  1. Go old-school and work with image maps. I haven't used an image map in years though, so that'd take a bit of testing to see if it's even possible.
  2. Use several target areas for each navigation element and position them in a staggered layout. Pretty hacky and bloated though.
  3. Use the rotate capability of fancy browsers. This actually doesn't seem too bad, but obviously not viewable for most users. Also not sure how that would affect the content areas - but could be explored.

Let me know if any clarification is needed.

Here is a sketch of the concept:
concept sketch http://img158.yfrog.com/img158/3122/slgu.jpg

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

若能看破又如何 2024-08-24 07:56:33

我只是指出一个 jQuery 插件可以很好地完成此任务(Diagonal Accordion)。我还没有测试过,但看起来它仅限于 45° 角度,这有点令人失望,但仍然很酷。

I was just pointed to a jQuery plugin that accomplishes this task pretty well (Diagonal Accordion). I have yet to test it, but it looks like it is limited to 45° angles, which is a bit of a bummer, but still pretty cool.

迷荒 2024-08-24 07:56:33

是的,我相信这是可以做到的。我满脑子想的都是你会做的事。首先为按钮创建有角度的图像。将这些图像按顺序放在 HTML 标记上,每个图像之间有一个 div 元素。所以标记会是这样的。

<img id="bttnOne" src="buttnImg1" onclick="openContent('bttnContentOne');" />
<div id="bttnContentOne" style="display: none">
   content1 content1 content1
</div>

<img id="bttnTwo" src="buttnImg2" onclick="openContent('bttnContentTwo');" />
<div id="bttnContentTwo" style="display: none">
   content2 content2 content2
</div>

您需要调整 css 以使它们正确适合。留在元素上的浮动效果会很好。现在您已经有了 HTML,您需要创建一个我在上面称为 openContent 的函数。如果需要,您可以将单击的按钮的 id 传递给该函数,或者您可以想出更好的方法来执行此操作。

openContent 函数看起来像下面这样,

function openContent(eleId) {
   $('.activeContent').slideUp('fast');                           //Close the currently opened content tab
   $('#' + eleId).slideDown('slow').class('activeContent');       //Open the new one and set the class
}

现在,我不确定如果需要向右或向左滑动,slideDown 看起来是否正确。如果没有,那么您可以尝试使用动画功能来左右滑动。这是一个非常粗略的例子,说明了如何做到这一点,所以不要指望这段代码能够工作,但主要的思维过程是正确的。

希望这有帮助!

大都会

(已编辑)

我个人不喜欢该示例的一件事是文本也是对角显示的。我相信使用“看起来”对角线的矩形框实际上会更好。这是一个粗略的 ascii 草图:)

---------------------------
|      /| content content |
|     / | content content |
|    /  | content content |
|   /   |                 |
|  /    |                 |
| /     |                 |
|/      |                 |
---------------------------

我不喜欢该特定实现的另一件事是扩展为您创建的所有 div 标签。此时效率非常低。希望将来我们能够轻松地完成这些类型的事情。但现在,如果您希望内容像该实现那样实际上是对角线的,则需要拥有所有这些 div 标签才能获得它。

Yes I believe this can be done. Thinking off of the top of my head this is what you would do. Create angled images for the buttons first. Put those images in order on the HTML markup, with a div element in between each one. So the markup would be something like this.

<img id="bttnOne" src="buttnImg1" onclick="openContent('bttnContentOne');" />
<div id="bttnContentOne" style="display: none">
   content1 content1 content1
</div>

<img id="bttnTwo" src="buttnImg2" onclick="openContent('bttnContentTwo');" />
<div id="bttnContentTwo" style="display: none">
   content2 content2 content2
</div>

You will need to adjust the css to make these fit correctly. A float left on the elements would work well. Now that you have the HTML, you will need to create a function which I called openContent above. You can pass the id of the button being clicked on to that function if you want, or you can come up with a better way to do this.

The openContent function would look something like the following,

function openContent(eleId) {
   $('.activeContent').slideUp('fast');                           //Close the currently opened content tab
   $('#' + eleId).slideDown('slow').class('activeContent');       //Open the new one and set the class
}

Now, im not positive that the slideDown will look correct if it needs to slide to the right, or left. If it does not, then you could try using the animate functionality to get a slide left and right. This is a VERY rough example of how this could be done, so dont expect this code to work, but the main thought process is correct.

Hope this helps!

Metropolis

(EDITED)

The one thing that I personally do not like about that example is how the text also displays diagonally. I believe it would actually be better to go with rectangle boxes that "look" diagonal. Here is a rough ascii sketch :)

---------------------------
|      /| content content |
|     / | content content |
|    /  | content content |
|   /   |                 |
|  /    |                 |
| /     |                 |
|/      |                 |
---------------------------

Another thing I do not like about that particular implementation is all of the div tags that the extension creates for you. It is very inefficient at this point. Hopefully in the future we will be able to do those type of things easily. Right now though, if you want the content to actually be diagonal like that implementation is, you will need to have all of those div tags to get it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文