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