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
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');
});
/*
* 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)