Response title
This is preview!




An accordion doesn't allow more than one content panel to be open at the same time, and it takes a lot of effort to do that. If you are looking for a widget that allows more than one content panel to be open, don't use this. Usually it can be written with a few lines of jQuery instead, something like this:
jQuery(document).ready(function(){
$('.accordion .head').click(function() {
$(this).next().toggle();
return false;
}).next().hide();
});jQuery(document).ready(function(){
$('.accordion .head').click(function() {
$(this).next().toggle();
return false;
}).next().hide();
});
- $("#myDiv").multiAccordion();
Here's the plugin code:
- (function ($) {
- $.fn.multiAccordion = function() {
- $(this).addClass("ui-accordion ui-accordion-icons ui-widget ui-helper-reset")
- .find("h3")
- .addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-top ui-corner-bottom")
- .hover(function() { $(this).toggleClass("ui-state-hover"); })
- .prepend('<span class="ui-icon ui-icon-triangle-1-e"></span>')
- .click(function() {
- $(this)
- .toggleClass("ui-accordion-header-active ui-state-active ui-state-default ui-corner-bottom")
- .find("> .ui-icon").toggleClass("ui-icon-triangle-1-e ui-icon-triangle-1-s").end()
- .next().toggleClass("ui-accordion-content-active").slideToggle();
- return false;
- })
- .next()
- .addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom")
- .css("display", "block")
- .hide()
- .end().trigger("click");
- };
- })(jQuery);
© 2012 jQuery Foundation
Sponsored by
and others.
