Вопрос

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
});

DEMO: http://jsfiddle.net/z7Rhn/

Read More: http://jqueryui.com/demos/accordion/#collapsible

Другие советы

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) {

});
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top