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("strong").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).find("strong").wrap("<div class='accordion-header'></div>"); 23 $(this).find("strong").after("<div class='accordion-header-icon'>"+settings.dropDownIcon+"</div>"); 24 $(this).children('.accordion-item').wrap('<div class="drawer"></div>'); 25 if(settings.firstChildExpand==true) 26 { 27 $(this).find(".accordion-header:first").toggleClass("accordion-header-active"); 28 $(this).find(".accordion-header:first").parent().toggleClass("accordion-item-active"); 29 $(this).find(".accordion-header:first").next().slideToggle(0); 30 $(this).find(".accordion-header:first").children(".accordion-header-icon").toggleClass("accordion-header-icon-active"); 31 } 32 $(this).find(".accordion-header").click( 33 function() 34 { 35 if(settings.multiExpand==false){ 36 if(!$(this).hasClass('accordion-header-active')) 37 { 38 $(this).parent().parent().parent().find(".accordion-header-active").removeClass('accordion-header-active'); 39 $(this).parent().parent().parent().find(".accordion-item-active").children(".accordion-content").slideUp(settings.slideSpeed); 40 $(this).parent().parent().parent().find(".accordion-header-icon-active").removeClass("accordion-header-icon-active"); 41 $(this).parent().parent().parent().find(".accordion-item-active").removeClass("accordion-item-active"); 42 } 43 } 44 $(this).toggleClass("accordion-header-active"); 45 $(this).parent().toggleClass("accordion-item-active"); 46 $(this).next().slideToggle(settings.slideSpeed); 47 $(this).children(".accordion-header-icon").toggleClass("accordion-header-icon-active"); 48 } 49 ); 50 }); 51 } 52 } 53(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.