downgrade to superfish 1.3 so it actually works

This commit is contained in:
Ted Serbinski 2007-11-22 03:41:53 +00:00
parent 36d7d5cf37
commit 3d8955fb48
3 changed files with 51 additions and 69 deletions

View File

@ -33,6 +33,6 @@ jQuery Superfish: http://users.tpg.com.au/j_birch/plugins/superfish/
4.0, 2007-Nov-21 4.0, 2007-Nov-21
---------------------- ----------------------
- new CHANGELOG to keep track of changes - 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) - 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 - remove RTL option; this conflicts with other changes and is properly implemented in Drupal 6

View File

@ -64,24 +64,24 @@
border:1px solid #999; 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; background:#3875d7;
color:#fff; color:#fff;
} }
#simplemenu li:hover ul,#simplemenu li.sfhover ul #simplemenu li:hover ul,#simplemenu li.sfHover ul
{ {
left:-1px; left:-1px;
top:20px; top:20px;
} }
#simplemenu li:hover li ul,#simplemenu li.sfhover li ul #simplemenu li:hover li ul,#simplemenu li.sfHover li ul
{ {
top:-999em; top:-999em;
} }
#simplemenu li li:hover ul,#simplemenu li li.sfhover ul #simplemenu li li:hover ul,#simplemenu li li.sfHover ul
{ {
left:14em; left:14em;
top:-1px; top:-1px;

View File

@ -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 * Copyright (c) 2007 Joel Birch
* *
@ -47,18 +47,14 @@ $(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
* *
* YOU SHOULD DELETE THIS CHANGELOG TO REDUCE FILE SIZE: * 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.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 * 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 * 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 * 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 * .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. * 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). * .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
*/ */
(function($){ (function($){
@ -69,44 +65,41 @@ $(document).ready(function() {
pathClass : 'overideThisToUse', pathClass : 'overideThisToUse',
delay : 800, delay : 800,
animation : {opacity:'show'}, animation : {opacity:'show'},
speed : 'normal', speed : 'normal'
onshow : function(){} // in your function, 'this' is the revealed ul
}, },
over = function(){ over = function(){
clearTimeout(this.sfTimer); clearTimeout(this.sfTimer);
clearTimeout($sf[0].sfTimer);
$(this) $(this)
.showSuperfishUl(o) .showSuperfishUl()
.siblings() .siblings()
.hideSuperfishUl(o); .hideSuperfishUl();
}, },
out = function(){ out = function(){
var $$ = $(this); var $$ = $(this);
if ( !$$.is('.'+o.bcClass) ) { if ( !$$.is('.'+o.bcClass) ) {
this.sfTimer=setTimeout(function(){ this.sfTimer=setTimeout(function(){
$$.hideSuperfishUl(o); $$.hideSuperfishUl();
var sf = $$.parents('ul.superfish:first')[0]; if (!$('.'+o.hoverClass,$sf).length) {
if (!$('.'+o.hoverClass,sf).length) { over.call($currents.hideSuperfishUl());
over.call(sf.o.$currents.hideSuperfishUl(o));
} }
},o.delay); },o.delay);
} }
}; };
$.fn.extend({ $.fn.extend({
hideSuperfishUl : function(o){ hideSuperfishUl : function(){
return this return this
.removeClass(o.hoverClass) .removeClass(o.hoverClass)
.find('ul') .find('ul:visible')
.hide() .hide()
.css('visibility','hidden')
.end(); .end();
}, },
showSuperfishUl : function(o){ showSuperfishUl : function(){
return this return this
.addClass(o.hoverClass) .addClass(o.hoverClass)
.find('>ul:hidden') .find('>ul:hidden')
.css('visibility','visible')
.animate(o.animation,o.speed,function(){ .animate(o.animation,o.speed,function(){
o.onshow.call(this); $(this).removeAttr('style');
}) })
.end(); .end();
}, },
@ -114,44 +107,33 @@ $(document).ready(function() {
return this[($.fn.hoverIntent) ? 'hoverIntent' : 'hover'](over,out); return this[($.fn.hoverIntent) ? 'hoverIntent' : 'hover'](over,out);
} }
}); });
o = $.extend({bcClass:'sfbreadcrumb'},defaults,o || {});
return this var $currents = $('.'+o.pathClass,this).filter('li[ul]');
.addClass('superfish') if ($currents.length) {
.each(function(){ $currents.each(function(){
o = $.extend({bcClass:'sfbreadcrumb'},defaults,o || {}); $(this).removeClass(o.pathClass).addClass(o.hoverClass+' '+o.bcClass);
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
});
});
}); });
}
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); })(jQuery);