jQuery ui 手风琴正常链接
我正在使用 jQuery UI accordion()
。我有 4 个标签。我想做 2 个滑动,这就是手风琴的工作方式,另外 2 个只是正常链接而不滑动。我不知道如何进行正常链接,因为手风琴需要
标记后的内容元素
<div id="test">
<h3><a href="#">One</a></h3>
<div>
some text
</div>
<h3><a href="#">Two</a></h3>
<div>
some text
</div>
<h3><a href="whatever.html">Link</a></h3>
<h3><a href="whatever1.html">Link</a></h3>
</div>
I'm using jQuery UI accordion()
. I have 4 tabs. I want to make 2 sliding which is the way accordion works, and the other 2 just normal links without sliding. I can't figure out how to do normal link since accordion expects an element for content after the <h3>
tag
<div id="test">
<h3><a href="#">One</a></h3>
<div>
some text
</div>
<h3><a href="#">Two</a></h3>
<div>
some text
</div>
<h3><a href="whatever.html">Link</a></h3>
<h3><a href="whatever1.html">Link</a></h3>
</div>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
看看手风琴方法(http://jqueryui.com/demos/accordion/),我不认识任何锁定项目不可打开的东西。
为什么不直接使用
div 的外部并正确设置它们的样式呢?
另外,您可以为标题设置不同的选择器,这将禁用该项目。例如:我将最后两个链接更改为 h2 并将手风琴设置为使用 h3 作为标题:
您
可以在这里看到它: http://jsfiddle.net/3JAkv/5/
你仍然需要用 CSS 来给它换肤
Looking at the accordion methods(http://jqueryui.com/demos/accordion/), I don't recognize anything for locking an item unopenable.
Why don't you just take the
outside of the
<div id="test">
div and just style them properly?Also, you could have a different selector for header, which will disable the item. For example: i changed the last two links to h2 and set the accordion to use h3 as header:
and
you can see it here: http://jsfiddle.net/3JAkv/5/
you still have to skin it with CSS though
您可以通过
jquery
更改最后 2 个选项卡的点击:jsfiddle: http ://jsfiddle.net/3JAkv/7/
You can alter the click on the last 2 tabs via
jquery
:jsfiddle: http://jsfiddle.net/3JAkv/7/
我花了几天时间但终于找到了答案。
按照文档中的建议构建手风琴,并在标题下方使用没有子条目的空 div。那么就需要这两个函数。
Took me a couple of days but I finally found an answer.
Build out your accordion as suggested in the documentation with empty divs below your headings that don't have sub entries. Then you need these two functions.
我认为你应该从手风琴中取出链接:
希望这会有所帮助。干杯
I think you should take the links out of the accordion:
Hope this helps. Cheers