修正jquery accordion 不能打开多个section问题

$.fn.togglepanels = function () {
    return this.each(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().slideToggle();
            return false;
        })
        .next()
          .addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom")
          .hide();
    });
};

或者另一种简单的办法就是创建两个jquery accordion

 

参考资料:

http://forum.jquery.com/topic/accordion-multiple-sections-open-at-once

http://jsfiddle.net/DkHyd/

posted @ 2012-12-24 15:45  Season2009  阅读(354)  评论(0编辑  收藏  举报