update to superfish 1.3

This commit is contained in:
Ted Serbinski 2007-11-22 01:38:45 +00:00
parent 08fe6616f9
commit 31259736e3
2 changed files with 89 additions and 34 deletions

View File

@ -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 3. Enable access to "view simplemenu" under administer > user management > access control
4. Configure menu to use under administer > site configuration > simplemenu 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

View File

@ -39,8 +39,9 @@ $(document).ready(function() {
$('#simplemenu').children('li.expanded').addClass('root'); $('#simplemenu').children('li.expanded').addClass('root');
}); });
/* /*
* Superfish - jQuery menu widget * Superfish v1.3 - jQuery menu widget
* *
* Copyright (c) 2007 Joel Birch * Copyright (c) 2007 Joel Birch
* *
@ -48,51 +49,96 @@ $(document).ready(function() {
* http://www.opensource.org/licenses/mit-license.php * http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html * 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($){ (function($){
$.fn.superfish = function(o){ $.fn.superfish = function(o){
var defaults = { var $sf = this,
hoverClass : "sfHover", defaults = {
delay : 500, hoverClass : 'sfHover',
animation : {opacity:"show"}, pathClass : 'overideThisToUse',
speed : "normal" delay : 800,
animation : {opacity:'show'},
speed : 'normal'
}, },
over = function(){ over = function(){
var $$ = $(this);
clearTimeout(this.sfTimer); clearTimeout(this.sfTimer);
if (!$$.is("."+o.hoverClass)) { clearTimeout($sf[0].sfTimer);
$$.addClass(o.hoverClass) $(this)
.find("ul") .showSuperfishUl()
.animate(o.animation,o.speed) .siblings()
.end() .hideSuperfishUl();
.siblings()
.removeClass(o.hoverClass);
}
}, },
out = function(){ out = function(){
var $$ = $(this); var $$ = $(this);
this.sfTimer=setTimeout(function(){ if ( !$$.is('.'+o.bcClass) ) {
$$.removeClass(o.hoverClass) this.sfTimer=setTimeout(function(){
.find("iframe", this) $$.hideSuperfishUl();
.remove(); if (!$('.'+o.hoverClass,$sf).length) {
},o.delay); over.call($currents.hideSuperfishUl());
}
},o.delay);
}
}; };
o = $.extend(defaults, o || {}); $.fn.extend({
var sfHovAr=$("li",this) hideSuperfishUl : function(){
.hover(over,out) return this
.find("a").each(function() { .removeClass(o.hoverClass)
var $a = $(this), $li = $a.parents("li"); .find('ul:visible')
$a.focus(function(){ $li.each(over); }) .hide()
.blur(function(){ $li.each(out); }); .end();
}).end(); },
$(window).unload(function() { showSuperfishUl : function(){
sfHovAr.unbind("mouseover").unbind("mouseout"); 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) /* Copyright (c) 2006 Brandon Aaron (http://brandonaaron.net)
* Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)