/* * superfish v1.4.8 - jquery menu widget * copyright (c) 2008 joel birch * * dual licensed under the mit and gpl licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html * http://www.yaoyingying.com/css/jquery/superfish/#getting-started [china] * * changelog: http://users.tpg.com.au/j_birch/plugins/superfish/changelog.txt */ ;(function($){ $.fn.superfish = function(op){ var sf = $.fn.superfish, c = sf.c, $arrow = $([' »'].join('')), over = function(){ var $$ = $(this), menu = getmenu($$); cleartimeout(menu.sftimer); $$.showsuperfishul().siblings().hidesuperfishul(); }, out = function(){ var $$ = $(this), menu = getmenu($$), o = sf.op; cleartimeout(menu.sftimer); menu.sftimer=settimeout(function(){ o.retainpath=($.inarray($$[0],o.$path)>-1); $$.hidesuperfishul(); if (o.$path.length && $$.parents(['li.',o.hoverclass].join('')).length<1){over.call(o.$path);} },o.delay); }, getmenu = function($menu){ var menu = $menu.parents(['ul.',c.menuclass,':first'].join(''))[0]; sf.op = sf.o[menu.serial]; return menu; }, addarrow = function($a){ $a.addclass(c.anchorclass).append($arrow.clone()); }; return this.each(function() { var s = this.serial = sf.o.length; var o = $.extend({},sf.defaults,op); o.$path = $('li.'+o.pathclass,this).slice(0,o.pathlevels).each(function(){ $(this).addclass([o.hoverclass,c.bcclass].join(' ')) .filter('li:has(ul)').removeclass(o.pathclass); }); sf.o[s] = sf.op = o; $('li:has(ul)',this)[($.fn.hoverintent && !o.disablehi) ? 'hoverintent' : 'hover'](over,out).each(function() { if (o.autoarrows) addarrow( $('>a:first-child',this) ); }) .not('.'+c.bcclass) .hidesuperfishul(); var $a = $('a',this); $a.each(function(i){ var $li = $a.eq(i).parents('li'); $a.eq(i).focus(function(){over.call($li);}).blur(function(){out.call($li);}); }); o.oninit.call(this); }).each(function() { var menuclasses = [c.menuclass]; if (sf.op.dropshadows && !($.browser.msie && $.browser.version < 7)) menuclasses.push(c.shadowclass); $(this).addclass(menuclasses.join(' ')); }); }; var sf = $.fn.superfish; sf.o = []; sf.op = {}; sf.ie7fix = function(){ var o = sf.op; if ($.browser.msie && $.browser.version > 6 && o.dropshadows && o.animation.opacity!=undefined) this.toggleclass(sf.c.shadowclass+'-off'); }; sf.c = { bcclass : 'sf-breadcrumb', menuclass : 'sf-js-enabled', anchorclass : 'sf-with-ul', arrowclass : 'sf-sub-indicator', shadowclass : 'sf-shadow' }; sf.defaults = { hoverclass : 'sfhover', pathclass : 'overidethistouse', pathlevels : 1, delay : 350, animation : {opacity:'show'}, speed : 'normal', autoarrows : true, dropshadows : true, disablehi : false, // true disables hoverintent detection oninit : function(){}, // callback functions onbeforeshow: function(){}, onshow : function(){}, onhide : function(){} }; $.fn.extend({ hidesuperfishul : function(){ var o = sf.op, not = (o.retainpath===true) ? o.$path : ''; o.retainpath = false; var $ul = $(['li.',o.hoverclass].join(''),this).add(this).not(not).removeclass(o.hoverclass) .find('>ul').hide().css('visibility','hidden'); o.onhide.call($ul); return this; }, showsuperfishul : function(){ var o = sf.op, sh = sf.c.shadowclass+'-off', $ul = this.addclass(o.hoverclass) .find('>ul:hidden').css('visibility','visible'); sf.ie7fix.call($ul); o.onbeforeshow.call($ul); $ul.animate(o.animation,o.speed,function(){ sf.ie7fix.call($ul); o.onshow.call($ul); }); return this; } }); })(jquery);