折叠全部,默认情况下仍然打开第一个手风琴
我正在尝试使用jquery手风琴。 我正在使用这个问题中的jsfiddle: jQuery UI Accordion展开/折叠全部
Kaneka Extranet CustomerDocs try { Typekit.load(); } catch (e) { } $(function () { $(".accordion").accordion({ collapsible: true, heightStyle: "content", active: false }); var icons = $(".accordion").accordion("option", "icons"); $('.open').click(function () { $('.ui-accordion-header').removeClass('ui-corner-all').addClass('ui-accordion-header-active ui-state-active ui-corner-top').attr({ 'aria-selected': 'true', 'tabindex': '0' }); $('.ui-accordion-header-icon').removeClass(icons.header).addClass(icons.headerSelected); $('.ui-accordion-content').addClass('ui-accordion-content-active').attr({ 'aria-expanded': 'true', 'aria-hidden': 'false' }).show(); $(this).attr("disabled", "disabled"); $('.close').removeAttr("disabled"); }); $('.close').click(function () { $('.ui-accordion-header').removeClass('ui-accordion-header-active ui-state-active ui-corner-top').addClass('ui-corner-all').attr({ 'aria-selected': 'false', 'tabindex': '-1' }); $('.ui-accordion-header-icon').removeClass(icons.headerSelected).addClass(icons.header); $('.ui-accordion-content').removeClass('ui-accordion-content-active').attr({ 'aria-expanded': 'false', 'aria-hidden': 'true' }).hide(); $(this).attr("disabled", "disabled"); $('.open').removeAttr("disabled"); }); $('.ui-accordion-header').click(function () { $('.open').removeAttr("disabled"); $('.close').removeAttr("disabled"); }); $('h1:eq(0)').trigger('click'); $('h2:eq(0)').trigger('click'); }); .accordion-expand-holder { margin: 10px 0; } .accordion-expand-holder .open, .accordion-expand-holder .close { margin: 0 10px 0 0; } Documents Overview
Welcome bschelkens@hotmail.com
High Performance Polymers
Safety Data Sheet
Here comes text. Technical Data Sheet
Here comes somes other text Eperan
Safety Data Sheet
Here comes some ohter text Technical Data Sheet
Some other text. {"appName":"InternetExplorer","requestId":"09c25ea2edd34132bcec5a536592ad9c"}
https://jsfiddle.net/bschelkens/5w3Lb9pv/14/
以上是我的页面看起来像。 出于某种原因,当我尝试我的小提琴时,它会做我所期待的。 但在我的代码中,这不起作用。
remove active:false
它默认会打开第一个选项。
见DEMO
$("#accordion").accordion({ collapsible:true, });
第二个选项, active:false
。 在代码末尾触发click事件。
$('h3:eq(0)').trigger('click');
见DEMO