diff --git a/README.txt b/README.txt index 46c3db32..e1c833af 100644 --- a/README.txt +++ b/README.txt @@ -24,4 +24,13 @@ jQuery Superfish: http://users.tpg.com.au/j_birch/plugins/superfish/ 3. Enable access to "view simplemenu" under administer > user management > access control -4. Configure menu to use under administer > site configuration > simplemenu \ No newline at end of file +4. Configure menu to use under administer > site configuration > simplemenu + + + +--- CHANGELOG -------------------------------------------------------- + +4.0, 2007-Nov-21 +---------------------- +- new CHANGELOG to keep track of changes +- #156256 upgrade to SuperFish 1.3 \ No newline at end of file diff --git a/simplemenu.js b/simplemenu.js index 33648b87..94f2a978 100644 --- a/simplemenu.js +++ b/simplemenu.js @@ -39,8 +39,9 @@ $(document).ready(function() { $('#simplemenu').children('li.expanded').addClass('root'); }); + /* - * Superfish - jQuery menu widget + * Superfish v1.3 - jQuery menu widget * * Copyright (c) 2007 Joel Birch * @@ -48,51 +49,96 @@ $(document).ready(function() { * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html * - * Last updated: 18/3/07 to remove iframes on 'out' + * 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($){ $.fn.superfish = function(o){ - var defaults = { - hoverClass : "sfHover", - delay : 500, - animation : {opacity:"show"}, - speed : "normal" + var $sf = this, + defaults = { + hoverClass : 'sfHover', + pathClass : 'overideThisToUse', + delay : 800, + animation : {opacity:'show'}, + speed : 'normal' }, over = function(){ - var $$ = $(this); clearTimeout(this.sfTimer); - if (!$$.is("."+o.hoverClass)) { - $$.addClass(o.hoverClass) - .find("ul") - .animate(o.animation,o.speed) - .end() - .siblings() - .removeClass(o.hoverClass); - } + clearTimeout($sf[0].sfTimer); + $(this) + .showSuperfishUl() + .siblings() + .hideSuperfishUl(); }, out = function(){ var $$ = $(this); - this.sfTimer=setTimeout(function(){ - $$.removeClass(o.hoverClass) - .find("iframe", this) - .remove(); - },o.delay); + if ( !$$.is('.'+o.bcClass) ) { + this.sfTimer=setTimeout(function(){ + $$.hideSuperfishUl(); + if (!$('.'+o.hoverClass,$sf).length) { + over.call($currents.hideSuperfishUl()); + } + },o.delay); + } }; - o = $.extend(defaults, o || {}); - var sfHovAr=$("li",this) - .hover(over,out) - .find("a").each(function() { - var $a = $(this), $li = $a.parents("li"); - $a.focus(function(){ $li.each(over); }) - .blur(function(){ $li.each(out); }); - }).end(); - $(window).unload(function() { - sfHovAr.unbind("mouseover").unbind("mouseout"); + $.fn.extend({ + hideSuperfishUl : function(){ + return this + .removeClass(o.hoverClass) + .find('ul:visible') + .hide() + .end(); + }, + showSuperfishUl : function(){ + return this + .addClass(o.hoverClass) + .find('>ul:hidden') + .animate(o.animation,o.speed,function(){ + $(this).removeAttr('style'); + }) + .end(); + }, + applySuperfishHovers : function(){ + return this[($.fn.hoverIntent) ? 'hoverIntent' : 'hover'](over,out); + } + }); + 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); }); - return this; }; -})(jQuery); +})(jQuery); + /* Copyright (c) 2006 Brandon Aaron (http://brandonaaron.net) * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)