1/** 2* @name Accordion 3* @descripton This Jquery plugin makes creating accordions pain free 4* @version 1.3 5* @requires Jquery 1.2.6+ 6* 7* @author Jan Jarfalk 8* @author-email [email protected] 9* @author-website http://www.unwrongest.com 10* 11* @licens MIT License - http://www.opensource.org/licenses/mit-license.php 12*/ 13 14(function(jQuery){ 15 jQuery.fn.extend({ 16 accordion: function() { 17 return this.each(function() { 18 19 var $ul = $(this); 20 21 if($ul.data('accordiated')) 22 return false; 23 24 $.each($ul.find('ul, li>div'), function(){ 25 $(this).data('accordiated', true); 26 $(this).hide(); 27 }); 28 29 $.each($ul.find('a'), function(){ 30 $(this).click(function(e){ 31 activate(this); 32 return void(0); 33 }); 34 }); 35 36 var active = (location.hash)?$(this).find('a[href=' + location.hash + ']')[0]:''; 37 38 if(active){ 39 activate(active, 'toggle'); 40 $(active).parents().show(); 41 } 42 43 function activate(el,effect){ 44 $(el).parent('li').toggleClass('active').siblings().removeClass('active').children('ul, div').slideUp('fast'); 45 $(el).siblings('ul, div')[(effect || 'slideToggle')]((!effect)?'fast':null); 46 } 47 48 }); 49 } 50 }); 51})(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.