Collapse all the tabs in a Accordion on jquery?

老子叫甜甜 提交于 2019-11-27 01:05:40

问题


By using the Telerik Extensions for ASP.NET MVC, how can I hide all the Accordion Tabs on page loading up ? By default, it will expand the first Accordion tab on page loading up! Thanks a lot!


回答1:


Try this:

It will disable all the active (open) pane.

$('.accordion').accordion({
    active: false,
    collapsible: true            
});



回答2:


View the jQuery, there is most likely an option to specify the tab to show; by default this is probably the first. You can override the behavior by adding additional jQuery.

If the accordion is a nested UL, the jQuery to hide all the nested UL elements would be like this:

$('ul.accordion ul').hide();

Be sure to place this after the jQuery that sets up the accordion functionality. Clicking any of the top LI should then show the nested UL.

The markup may be different, but the logic should be very similar.



来源:https://stackoverflow.com/questions/1592494/collapse-all-the-tabs-in-a-accordion-on-jquery

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!