1 2/* 3 * Superfish v1.4.8 - jQuery menu widget 4 * Copyright (c) 2008 Joel Birch 5 * 6 * Dual licensed under the MIT and GPL licenses: 7 * http://www.opensource.org/licenses/mit-license.php 8 * http://www.gnu.org/licenses/gpl.html 9 * 10 * CHANGELOG: http://users.tpg.com.au/j_birch/plugins/superfish/changelog.txt 11 */ 12 13;(function($){ 14 $.fn.superfish = function(op){ 15 16 var sf = $.fn.superfish, c = sf.c, 17 $arrow = $(['<span class="',c.arrowClass,'"> ›</span>'].join('')), 18 over = function(){ 19 var $$ = $(this), menu = getMenu($$); 20 clearTimeout(menu.sfTimer); 21 $$.showSuperfishUl().siblings().hideSuperfishUl(); 22 }, 23 out = function(){ 24 var $$ = $(this), menu = getMenu($$), o = sf.op; 25 clearTimeout(menu.sfTimer); 26 menu.sfTimer=setTimeout(function(){ 27 o.retainPath=($.inArray($$[0],o.$path)>-1); 28 $$.hideSuperfishUl(); 29 if (o.$path.length && $$.parents(['li.',o.hoverClass].join('')).length<1){over.call(o.$path);} 30 },o.delay); 31 }, 32 getMenu = function($menu){ 33 var menu = $menu.parents(['ul.',c.menuClass,':first'].join(''))[0]; 34 sf.op = sf.o[menu.serial]; 35 return menu; 36 }, 37 addArrow = function($a){ $a.addClass(c.anchorClass).append($arrow.clone()); }; 38 39 return this.each(function() { 40 var s = this.serial = sf.o.length; 41 var o = $.extend({},sf.defaults,op); 42 o.$path = $('li.'+o.pathClass,this).slice(0,o.pathLevels).each(function(){ 43 $(this).addClass([o.hoverClass,c.bcClass].join(' ')) 44 .filter('li:has(ul)').removeClass(o.pathClass); 45 }); 46 sf.o[s] = sf.op = o; 47 48 $('li:has(ul)',this)[($.fn.hoverIntent && !o.disableHI) ? 'hoverIntent' : 'hover'](over,out).each(function() { 49 if (o.autoArrows) addArrow( $('>a:first-child',this) ); 50 }) 51 .not('.'+c.bcClass) 52 .hideSuperfishUl(); 53 54 var $a = $('a',this); 55 $a.each(function(i){ 56 var $li = $a.eq(i).parents('li'); 57 }); 58 o.onInit.call(this); 59 60 }).each(function() { 61 var menuClasses = [c.menuClass]; 62 if (sf.op.dropShadows && !($.browser.msie && $.browser.version < 7)) menuClasses.push(c.shadowClass); 63 $(this).addClass(menuClasses.join(' ')); 64 }); 65 }; 66 67 var sf = $.fn.superfish; 68 sf.o = []; 69 sf.op = {}; 70 sf.IE7fix = function(){ 71 var o = sf.op; 72 if ($.browser.msie && $.browser.version > 6 && o.dropShadows && o.animation.opacity!=undefined) 73 this.toggleClass(sf.c.shadowClass+'-off'); 74 }; 75 sf.c = { 76 bcClass : 'sf-breadcrumb', 77 menuClass : 'sf-js-enabled', 78 anchorClass : 'sf-with-ul', 79 arrowClass : 'menu-arrow', 80 shadowClass : 'sf-shadow' 81 }; 82 sf.defaults = { 83 hoverClass : 'sfHover', 84 pathClass : 'overideThisToUse', 85 pathLevels : 2, 86 delay : 1000, 87 animation : {height:'show'}, 88 speed : 'normal', 89 autoArrows : false, 90 dropShadows : false, 91 disableHI : false, // true disables hoverIntent detection 92 onInit : function(){}, // callback functions 93 onBeforeShow: function(){}, 94 onShow : function(){}, 95 onHide : function(){} 96 }; 97 $.fn.extend({ 98 hideSuperfishUl : function(){ 99 var o = sf.op, 100 not = (o.retainPath===true) ? o.$path : ''; 101 o.retainPath = false; 102 var $ul = $(['li.',o.hoverClass].join(''),this).add(this).not(not).removeClass(o.hoverClass) 103 .find('>ul').hide(); 104 o.onHide.call($ul); 105 return this; 106 }, 107 showSuperfishUl : function(){ 108 var o = sf.op, 109 sh = sf.c.shadowClass+'-off', 110 $ul = this.not('.accorChild').addClass(o.hoverClass) 111 .find('>ul:hidden'); 112 sf.IE7fix.call($ul); 113 o.onBeforeShow.call($ul); 114 $ul.animate(o.animation,o.speed,function(){ sf.IE7fix.call($ul); o.onShow.call($ul); }); 115 return this; 116 } 117 }); 118 119})(jQuery); 120/*---------------------*/ 121var menuCl='menu'; 122 123$(function() { 124 $('.menu').superfish({autoArrows: true}) 125 $('#menu-icon').on('click', function(){ 126 $('.menu').slideToggle(); 127 $(this).toggleClass('active'); 128 }); 129})
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.