diff --git a/README.txt b/README.txt index 6793a196..be25bebc 100644 --- a/README.txt +++ b/README.txt @@ -33,6 +33,6 @@ jQuery Superfish: http://users.tpg.com.au/j_birch/plugins/superfish/ 4.0, 2007-Nov-21 ---------------------- - new CHANGELOG to keep track of changes -- #156256 upgrade to SuperFish 1.3.2 +- #156256 upgrade to SuperFish 1.3 - upgrade to bgIframe 2.1.1 (for IE6 compatibility with forms) - remove RTL option; this conflicts with other changes and is properly implemented in Drupal 6 \ No newline at end of file diff --git a/simplemenu.css b/simplemenu.css index 489482a7..d84a919d 100644 --- a/simplemenu.css +++ b/simplemenu.css @@ -64,24 +64,24 @@ border:1px solid #999; } -#simplemenu li:hover,#simplemenu li.sfhover,#simplemenu a:focus,#simplemenu a:hover,#simplemenu a:active +#simplemenu li:hover,#simplemenu li.sfHover,#simplemenu a:focus,#simplemenu a:hover,#simplemenu a:active { background:#3875d7; color:#fff; } -#simplemenu li:hover ul,#simplemenu li.sfhover ul +#simplemenu li:hover ul,#simplemenu li.sfHover ul { left:-1px; top:20px; } -#simplemenu li:hover li ul,#simplemenu li.sfhover li ul +#simplemenu li:hover li ul,#simplemenu li.sfHover li ul { top:-999em; } -#simplemenu li li:hover ul,#simplemenu li li.sfhover ul +#simplemenu li li:hover ul,#simplemenu li li.sfHover ul { left:14em; top:-1px; diff --git a/simplemenu.js b/simplemenu.js index cd4a50ed..7baf121c 100644 --- a/simplemenu.js +++ b/simplemenu.js @@ -39,7 +39,7 @@ $(document).ready(function() { /* - * Superfish v1.3.2 - jQuery menu widget + * Superfish v1.3 - jQuery menu widget * * Copyright (c) 2007 Joel Birch * @@ -47,18 +47,14 @@ $(document).ready(function() { * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html * - * YOU SHOULD DELETE THIS CHANGELOG TO REDUCE FILE SIZE: - * v1.2.1 altered: 2nd July 07. added hide() before animate to make work for jQuery 1.1.3. See comment in 'over' function. - * v1.2.2 altered: 2nd August 07. changed over function .find('ul') to .find('>ul') for smoother animations - * Also deleted the iframe removal lines - not necessary it turns out - * v1.2.3 altered: jquery 1.1.3.1 broke keyboard access - had to change quite a few things and set display:none on the - * .superfish rule in CSS instead of top:-999em - * v1.3 : Pretty much a complete overhaul to make all original features work in 1.1.3.1 and above. - * .superfish rule reverted back to top:-999em (which is better). - * v1.3.1 altered: 'li[ul]' to $('li:has(ul)') to work with jQuery 1.2 - * v1.3.2: added onshow callback option. 'this' keyword refers to revealed ul. - fixed bug whereby multiple menus on a page shared options. Now each menu can have separate options. - fixed IE6 and IE7 bug whereby under certain circumstances => 3rd tier menus appear instantly with text missing when revisited + * YOU MAY DELETE THIS CHANGELOG: + * v1.2.1 altered: 2nd July 07. added hide() before animate to make work for jQuery 1.1.3. See comment in 'over' function. + * v1.2.2 altered: 2nd August 07. changed over function .find('ul') to .find('>ul') for smoother animations + * Also deleted the iframe removal lines - not necessary it turns out + * v1.2.3 altered: jquery 1.1.3.1 broke keyboard access - had to change quite a few things and set display:none on the + * .superfish rule in CSS instead of top:-999em + * v1.3 : Pretty much a complete overhaul to make all original features work in 1.1.3.1 and above. + * .superfish rule reverted back to top:-999em (which is better) */ (function($){ @@ -69,44 +65,41 @@ $(document).ready(function() { pathClass : 'overideThisToUse', delay : 800, animation : {opacity:'show'}, - speed : 'normal', - onshow : function(){} // in your function, 'this' is the revealed ul + speed : 'normal' }, over = function(){ clearTimeout(this.sfTimer); + clearTimeout($sf[0].sfTimer); $(this) - .showSuperfishUl(o) + .showSuperfishUl() .siblings() - .hideSuperfishUl(o); + .hideSuperfishUl(); }, out = function(){ var $$ = $(this); if ( !$$.is('.'+o.bcClass) ) { this.sfTimer=setTimeout(function(){ - $$.hideSuperfishUl(o); - var sf = $$.parents('ul.superfish:first')[0]; - if (!$('.'+o.hoverClass,sf).length) { - over.call(sf.o.$currents.hideSuperfishUl(o)); + $$.hideSuperfishUl(); + if (!$('.'+o.hoverClass,$sf).length) { + over.call($currents.hideSuperfishUl()); } },o.delay); } }; $.fn.extend({ - hideSuperfishUl : function(o){ + hideSuperfishUl : function(){ return this .removeClass(o.hoverClass) - .find('ul') + .find('ul:visible') .hide() - .css('visibility','hidden') .end(); }, - showSuperfishUl : function(o){ + showSuperfishUl : function(){ return this .addClass(o.hoverClass) .find('>ul:hidden') - .css('visibility','visible') .animate(o.animation,o.speed,function(){ - o.onshow.call(this); + $(this).removeAttr('style'); }) .end(); }, @@ -114,44 +107,33 @@ $(document).ready(function() { return this[($.fn.hoverIntent) ? 'hoverIntent' : 'hover'](over,out); } }); - - return this - .addClass('superfish') - .each(function(){ - o = $.extend({bcClass:'sfbreadcrumb'},defaults,o || {}); - o = $.extend(o,{$currents:$('li.'+o.pathClass+':has(ul)',this)}); - this.o = o; - if (o.$currents.length) { - o.$currents.each(function(){ - $(this).removeClass(o.pathClass).addClass(o.hoverClass+' '+o.bcClass); - }); - } - - var $sfHovAr=$('li:has(ul)',this) - .applySuperfishHovers(over,out) - .find('a').each(function(){ - var $a = $(this), $li = $a.parents('li'); - $a.focus(function(){ - over.call($li); - return false; - }).blur(function(){ - out.call(this); - $li.removeClass(o.hoverClass); - return false; - }); - }) - .end() - .not('.'+o.bcClass) - .hideSuperfishUl(o) - .end(); - - $(window).unload(function(){ - $sfHovAr.unbind('mouseover').unbind('mouseout'); - $('ul.superfish').each(function(){ - this.o = this.o.$currents = null; // clean up - }); - }); + o = $.extend({bcClass:'sfbreadcrumb'},defaults,o || {}); + var $currents = $('.'+o.pathClass,this).filter('li[ul]'); + if ($currents.length) { + $currents.each(function(){ + $(this).removeClass(o.pathClass).addClass(o.hoverClass+' '+o.bcClass); }); + } + var $sfHovAr=$('li[ul]',this).applySuperfishHovers(over,out) + .find('a').each(function(){ + var $a = $(this), $li = $a.parents('li'); + $a.focus(function(){ + over.call($li); + return false; + }).blur(function(){ + $li.removeClass(o.hoverClass); + }); + }) + .end() + .not('.'+o.bcClass) + .hideSuperfishUl() + .end(); + $(window).unload(function(){ + $sfHovAr.unbind('mouseover').unbind('mouseout'); + }); + return this.addClass('superfish').blur(function(){ + out.call(this); + }); }; })(jQuery);