making jquery accordions default to closed
-
13-06-2021 - |
سؤال
http://jqueryui.com/demos/accordion/
You can do $('#itename').accordion('activate', 0)
to make an accordion closed but that'll change the page focus, which I don't want to do. I could refocus the page to the top but that won't work if I'm doing whatever.html#elementID
to set the focus.
المحلول
You need to set collapsible
to true
, and active
to false
.
$( "#accordion" ).accordion({
collapsible: true,
active: false
});
نصائح أخرى
may be this approach will be useful
write a function to accordion change whcich will do two things:- 1.close the accordion. 2.than write code to focus the new element
change event
$('.ui-accordion').bind('accordionchange', function(event, ui) {
});
لا تنتمي إلى StackOverflow