如何使用 JQuery Accordion 执行此操作?
使用此处的示例:
http://jqueryui.com/demos/accordion/#custom-icons
我想让这些箭头和手风琴的工作方式完全相同,但是我当前的代码如下,带有静态 html(使用 UL 和 LI):
<li id="ecartcategorieswidget-3" class="widget-1 widget-first widget sbg_widget Shop widget_ecartcategorieswidget">
<h2 class="widgettitle sbg_title">Categories</h2>
<ul class="ecart_categories">
<li><a href="http://">category1</a>
<ul class="children">
<li><a href="http://">sub-category</a></li>
<li><a href="http://">sub-category</a>
<ul class="children">
<li><a href="http://">sub-sub-category</a></li>
</ul></li>
</ul>
</li>
<li class="current><a href="http://">category2</a>
<ul class="children">
<li><a href="http://">sub-category</a></li>
<li><a href="http://">sub-category</a>
<ul class="children">
<li><a href="http://">sub-sub-category</a></li>
</ul></li>
</ul>
</li>
</ul>
</li>
How do I make the JQuery example for my 上述 html 代码,那么category1和category2就像提供的示例jQuery url中的第1部分和第2部分一样吗?单击任一类别时,该类别中的所有子类别和子子类别都会一起向下滑动。它实际上是一个有 2 个类别的单级手风琴。
谢谢!
Using the example from here:
http://jqueryui.com/demos/accordion/#custom-icons
I want to have those arrows and the accordion working the exact same, however my current code is as follows with static html (uses UL and LI's):
<li id="ecartcategorieswidget-3" class="widget-1 widget-first widget sbg_widget Shop widget_ecartcategorieswidget">
<h2 class="widgettitle sbg_title">Categories</h2>
<ul class="ecart_categories">
<li><a href="http://">category1</a>
<ul class="children">
<li><a href="http://">sub-category</a></li>
<li><a href="http://">sub-category</a>
<ul class="children">
<li><a href="http://">sub-sub-category</a></li>
</ul></li>
</ul>
</li>
<li class="current><a href="http://">category2</a>
<ul class="children">
<li><a href="http://">sub-category</a></li>
<li><a href="http://">sub-category</a>
<ul class="children">
<li><a href="http://">sub-sub-category</a></li>
</ul></li>
</ul>
</li>
</ul>
</li>
How do I make the JQuery example work for my above html code, so that category1 and category2 is like section 1 and section 2 in the example jQuery url provided? When clicking on either category, all the sub and sub-sub categories within that category slide down together. It's literally a one-level accordion with 2 categories.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
本文给出了如何将列表设计为手风琴样式的概要。这是一个示例: http://demos.net.tutsplus.com/020_jQueryUI /accordion-jquery-ui.htm。
本质上,只需摆弄以下样式:
看看将其应用到标记时的样子: http:// /jsfiddle.net/william/WbTPk/1/。
This article gives a run-down on how to style lists as an accordion. Here's an example: http://demos.net.tutsplus.com/020_jQueryUI/accordion-jquery-ui.htm.
Essentially, just fiddle with the following style:
See how it looks like when applying it to your markup: http://jsfiddle.net/william/WbTPk/1/.