1( 2 function($) 3 { 4 $.fn.accordion = function(options) 5 { 6 return this.each(function() { 7 var settings = $.extend( 8 { 9 firstChildExpand: true, 10 multiExpand: false, 11 slideSpeed: 500, 12 dropDownIcon: '▼' 13 }, options ); 14 15 $(this).children("h1").each( 16 function() 17 { 18 $(this).next('div').andSelf().wrapAll("<div class='accordion-item'></div>"); 19 } 20 ); 21 //$(this).children().children('div').addClass("accordion-content"); 22 $(this).children().children('div').each(function(idx,obj){ 23 if ($(obj).hasClass("accordion-header-icon")==false) $(obj).addClass("accordion-content"); 24 }); 25 $(this).find("h1").wrap("<div class='accordion-header'></div>"); 26 $(this).find("h1").after("<div class='accordion-header-icon'>"+settings.dropDownIcon+"</div>"); 27 $(this).children('.accordion-item').wrap('<div class="drawer"></div>'); 28 if(settings.firstChildExpand==true) 29 { 30 $(this).find(".accordion-header:first").toggleClass("accordion-header-active"); 31 $(this).find(".accordion-header:first").parent().toggleClass("accordion-item-active"); 32 $(this).find(".accordion-header:first").next().slideToggle(0); 33 $(this).find(".accordion-header:first").children(".accordion-header-icon").toggleClass("accordion-header-icon-active"); 34 } 35 $(this).find(".accordion-header").click( 36 function() 37 { 38 if(settings.multiExpand==false){ 39 if(!$(this).hasClass('accordion-header-active')) 40 { 41 $(this).parent().parent().parent().find(".accordion-header-active").removeClass('accordion-header-active'); 42 $(this).parent().parent().parent().find(".accordion-item-active").children(".accordion-content").slideUp(settings.slideSpeed); 43 $(this).parent().parent().parent().find(".accordion-header-icon-active").removeClass("accordion-header-icon-active"); 44 $(this).parent().parent().parent().find(".accordion-item-active").removeClass("accordion-item-active"); 45 } 46 } 47 $(this).toggleClass("accordion-header-active"); 48 $(this).parent().toggleClass("accordion-item-active"); 49 $(this).next().slideToggle(settings.slideSpeed); 50 $(this).children(".accordion-header-icon").toggleClass("accordion-header-icon-active"); 51 } 52 ); 53 }); 54 } 55 $.fn.openSection = function(index) 56 { 57 $(".accordion").find(".accordion-header").filter(function(indexx){return indexx==index;}).click(); 58 //$(".accordion2").find(".accordion-header").filter(function(indexx){return indexx==index;}).click(); 59 } 60 } 61(jQuery));
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.