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, 17 c = sf.c, 18 $arrow = $(['<b class="',c.arrowClass,'"></b>'].join('')), 19 over = function(){ 20 var $$ = $(this), menu = getMenu($$); 21 clearTimeout(menu.sfTimer); 22 $$.showSuperfishUl().siblings().hideSuperfishUl(); 23 }, 24 out = function(){ 25 var $$ = $(this), menu = getMenu($$), o = sf.op; 26 clearTimeout(menu.sfTimer); 27 menu.sfTimer=setTimeout(function(){ 28 o.retainPath=($.inArray($$[0],o.$path)>-1); 29 $$.hideSuperfishUl(); 30 if (o.$path.length && $$.parents(['li.',o.hoverClass].join('')).length<1){over.call(o.$path);} 31 },o.delay); 32 }, 33 getMenu = function($menu){ 34 var menu = $menu.parents(['ul.',c.menuClass,':first'].join(''))[0]; 35 sf.op = sf.o[menu.serial]; 36 return menu; 37 }, 38 addArrow = function($a){ $a.addClass(c.anchorClass).append($arrow.clone()); }; 39 40 return this.each(function() { 41 var s = this.serial = sf.o.length; 42 var o = $.extend({},sf.defaults,op); 43 o.$path = $('li.'+o.pathClass,this).slice(0,o.pathLevels).each(function(){ 44 $(this).addClass([o.hoverClass,c.bcClass].join(' ')) 45 .filter('li:has(ul)').removeClass(o.pathClass); 46 }); 47 sf.o[s] = sf.op = o; 48 49 $('li:has(ul)',this)[($.fn.hoverIntent && !o.disableHI) ? 'hoverIntent' : 'hover'](over,out).each(function() { 50 if (o.autoArrows) addArrow( $('>a:first-child',this) ); 51 }) 52 .not('.'+c.bcClass) 53 .hideSuperfishUl(); 54 55 var $a = $('a',this); 56 $a.each(function(i){ 57 var $li = $a.eq(i).parents('li'); 58 }); 59 o.onInit.call(this); 60 61 }).each(function() { 62 var menuClasses = [c.menuClass]; 63 if (sf.op.dropShadows && !($.browser.msie && $.browser.version < 7)) menuClasses.push(c.shadowClass); 64 $(this).addClass(menuClasses.join(' ')); 65 }); 66 }; 67 68 var sf = $.fn.superfish; 69 sf.o = []; 70 sf.op = {}; 71 sf.IE7fix = function(){ 72 var o = sf.op; 73 if ($.browser.msie && $.browser.version > 6 && o.dropShadows && o.animation.opacity!=undefined) 74 this.toggleClass(sf.c.shadowClass+'-off'); 75 }; 76 sf.c = { 77 bcClass : 'sf-breadcrumb', 78 menuClass : 'sf-js-enabled', 79 anchorClass : 'sf-with-ul', 80 arrowClass : 'sf-sub-indicator', 81 shadowClass : 'sf-shadow' 82 }; 83 sf.defaults = { 84 hoverClass : 'sfHover', 85 pathClass : 'overideThisToUse', 86 pathLevels : 2, 87 delay : 800, 88 animation : {height:'show'}, 89 speed : 'normal', 90 autoArrows : true, 91 dropShadows : false, 92 disableHI : false, // true disables hoverIntent detection 93 onInit : function(){}, // callback functions 94 onBeforeShow: function(){}, 95 onShow : function(){}, 96 onHide : function(){} 97 }; 98 $.fn.extend({ 99 hideSuperfishUl : function(){ 100 var o = sf.op, 101 not = (o.retainPath===true) ? o.$path : ''; 102 o.retainPath = false; 103 var $ul = $(['li.',o.hoverClass].join(''),this).add(this).not(not).removeClass(o.hoverClass) 104 .find('>ul').fadeOut(); 105 o.onHide.call($ul); 106 return this; 107 }, 108 showSuperfishUl : function(){ 109 var o = sf.op, 110 sh = sf.c.shadowClass+'-off', 111 $ul = this.not('.accorChild').addClass(o.hoverClass) 112 .find('>ul:hidden'); 113 sf.IE7fix.call($ul); 114 o.onBeforeShow.call($ul); 115 $ul.animate(o.animation,o.speed,function(){ sf.IE7fix.call($ul); o.onShow.call($ul); }); 116 return this; 117 } 118 }); 119 120})(jQuery); 121/*---------------------*/ 122 123$(function(){ 124 $('.sf-menu').superfish({ 125 delay: 600, // one second delay on mouseout 126 animation: {opacity:'show'}, // fade-in and slide-down animation 127 speed: 'normal', // faster animation speed 128 // disable generation of arrow mark-up 129 dropShadows: false 130 131 }) 132 133 134 135})
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.