Add Superfish 1.7.3

Source taken from https://github.com/joeldbirch/superfish/tree/1.7.3
This commit is contained in:
Rich Milns
2013-06-06 15:03:16 +01:00
parent 2f3954897e
commit 32f4db571c
11 changed files with 620 additions and 0 deletions
+100
View File
@@ -0,0 +1,100 @@
/*** ESSENTIAL STYLES ***/
.sf-menu {
position: relative;
margin: 0;
padding: 0;
list-style: none;
}
.sf-menu .sf-mega {
position: absolute;
display: none;
top: 100%;
left: 0;
z-index: 99;
}
.sf-menu > li {
float: left;
}
.sf-menu li:hover > .sf-mega,
.sf-menu li.sfHover > .sf-mega {
display: block;
}
.sf-menu > li > a {
display: block;
position: relative;
}
/*** DEMO SKIN ***/
.sf-menu {
float: left;
margin-bottom: 1em;
width: 100%;
}
.sf-menu .sf-mega {
box-shadow: 2px 3px 6px rgba(0,0,0,.2);
width: 100%; /* allow long menu items to determine submenu width */
}
.sf-menu > li > a {
border-left: 1px solid #fff;
border-top: 1px solid #dFeEFF; /* fallback colour must use full shorthand */
border-top: 1px solid rgba(255,255,255,.5);
padding: .75em 1em;
text-decoration: none;
zoom: 1; /* IE7 */
color: #13a;
}
.sf-menu > li {
background: #BDD2FF;
-webkit-transition: background .2s;
transition: background .2s;
}
.sf-menu > li:hover,
.sf-menu > li.sfHover {
background: #CFDEFF;
/* only transition out, not in */
-webkit-transition: none;
transition: none;
}
/*** mega menu dropdown ***/
.sf-mega {
background-color: #CFDEFF;
padding: 1em;
box-sizing: border-box;
width: 100%;
}
.sf-mega-section {
float: left;
width: 8em; /* optional */
padding: 0 1em 1em 0;
margin-right: 1em;
border-right: 1px solid #b4c8f5;
}
/*** arrows (for all except IE7) **/
.sf-arrows .sf-with-ul {
padding-right: 2.5em;
*padding-right: 1em; /* no CSS arrows for IE7 (lack pseudo-elements) */
}
/* styling for both css and generated arrows */
.sf-arrows .sf-with-ul:after {
content: '';
position: absolute;
top: 50%;
right: 1em;
margin-top: -3px;
height: 0;
width: 0;
/* order of following 3 rules important for fallbacks to work */
border: 5px solid transparent;
border-top-color: #dFeEFF; /* edit this to suit design (no rgba in IE8) */
border-top-color: rgba(255,255,255,.5);
}
.sf-arrows > li > .sf-with-ul:focus:after,
.sf-arrows > li:hover > .sf-with-ul:after,
.sf-arrows > .sfHover > .sf-with-ul:after {
border-top-color: white; /* IE8 fallback colour */
}
+1
View File
@@ -0,0 +1 @@
.sf-menu{position:relative;margin:0;padding:0;list-style:none}.sf-menu .sf-mega{position:absolute;display:none;top:100%;left:0;z-index:99}.sf-menu>li{float:left}.sf-menu li:hover>.sf-mega,.sf-menu li.sfHover>.sf-mega{display:block}.sf-menu>li>a{display:block;position:relative}.sf-menu{float:left;margin-bottom:1em;width:100%}.sf-menu .sf-mega{box-shadow:2px 3px 6px rgba(0,0,0,.2);width:100%}.sf-menu>li>a{border-left:1px solid #fff;border-top:1px solid #dfeeff;border-top:1px solid rgba(255,255,255,.5);padding:.75em 1em;text-decoration:none;zoom:1;color:#13a}.sf-menu>li{background:#bdd2ff;-webkit-transition:background .2s;transition:background .2s}.sf-menu>li:hover,.sf-menu>li.sfHover{background:#cfdeff;-webkit-transition:none;transition:none}.sf-mega{background-color:#cfdeff;padding:1em;box-sizing:border-box;width:100%}.sf-mega-section{float:left;width:8em;padding:0 1em 1em 0;margin-right:1em;border-right:1px solid #b4c8f5}.sf-arrows .sf-with-ul{padding-right:2.5em;*padding-right:1em}.sf-arrows .sf-with-ul:after{content:'';position:absolute;top:50%;right:1em;margin-top:-3px;height:0;width:0;border:5px solid transparent;border-top-color:#dfeeff;border-top-color:rgba(255,255,255,.5)}.sf-arrows>li>.sf-with-ul:focus:after,.sf-arrows>li:hover>.sf-with-ul:after,.sf-arrows>.sfHover>.sf-with-ul:after{border-top-color:white}
@@ -0,0 +1,82 @@
/*** adding the class sf-navbar in addition to sf-menu creates an all-horizontal nav-bar menu ***/
.sf-navbar {
background: #BDD2FF;
position: relative;
margin-bottom: 5em;
}
/* provide background colour for submenu strip */
/* you should just set the menu's container bg colour rather than use pseudo-elements */
.sf-navbar:before {
content: '';
position: absolute;
left: 0;
z-index: -1;
background-color: #BDD2FF;
height: 200%;
width: 100%;
}
.sf-navbar ul {
box-shadow: none;
}
.sf-navbar li {
background: #AABDE6;
position: static;
}
.sf-navbar > li > a,
.sf-navbar > li > ul > li > a {
border: none;
}
.sf-navbar > li > ul {
min-width: 36em; /* set this to whatever suits your design */
}
.sf-navbar ul li {
background: #BDD2FF;
position: relative;
}
.sf-navbar ul ul {
left: 0;
top: 100%;
}
.sf-navbar ul ul li {
width: 100%;
}
.sf-navbar > li > ul > li {
float: left;
}
.sf-navbar li.current {
background: #BDD2FF;
}
.sf-navbar li:hover,
.sf-navbar li.sfHover,
.sf-navbar ul li.current {
background: #BDD2FF;
}
.sf-navbar ul li:hover,
.sf-navbar ul li.sfHover,
.sf-navbar ul ul li {
background: #D1DFFF;
}
.sf-navbar ul ul li:hover,
.sf-navbar ul ul li.sfHover,
.sf-navbar ul ul li.current {
background: #E6EEFF;
}
.sf-navbar ul li.current > a {
font-weight: bold;
}
/*** point all arrows down ***/
.sf-arrows.sf-navbar ul .sf-with-ul:after {
margin-top: -3px;
margin-right: 0;
border-color: transparent;
border-top-color: #dFeEFF; /* edit this to suit design (no rgba in IE8) */
border-top-color: rgba(255,255,255,.5);
}
.sf-arrows.sf-navbar ul > li > .sf-with-ul:focus:after,
.sf-arrows.sf-navbar ul > li:hover > .sf-with-ul:after,
.sf-arrows.sf-navbar ul > .sfHover > .sf-with-ul:after {
border-color: transparent;
border-top-color: white;
}
+1
View File
@@ -0,0 +1 @@
.sf-navbar{background:#bdd2ff;position:relative;margin-bottom:5em}.sf-navbar:before{content:'';position:absolute;left:0;z-index:-1;background-color:#bdd2ff;height:200%;width:100%}.sf-navbar ul{box-shadow:none}.sf-navbar li{background:#aabde6;position:static}.sf-navbar>li>a,.sf-navbar>li>ul>li>a{border:0}.sf-navbar>li>ul{min-width:36em}.sf-navbar ul li{background:#bdd2ff;position:relative}.sf-navbar ul ul{left:0;top:100%}.sf-navbar ul ul li{width:100%}.sf-navbar>li>ul>li{float:left}.sf-navbar li.current{background:#bdd2ff}.sf-navbar li:hover,.sf-navbar li.sfHover,.sf-navbar ul li.current{background:#bdd2ff}.sf-navbar ul li:hover,.sf-navbar ul li.sfHover,.sf-navbar ul ul li{background:#d1dfff}.sf-navbar ul ul li:hover,.sf-navbar ul ul li.sfHover,.sf-navbar ul ul li.current{background:#e6eeff}.sf-navbar ul li.current>a{font-weight:bold}.sf-arrows.sf-navbar ul .sf-with-ul:after{margin-top:-3px;margin-right:0;border-color:transparent;border-top-color:#dfeeff;border-top-color:rgba(255,255,255,.5)}.sf-arrows.sf-navbar ul>li>.sf-with-ul:focus:after,.sf-arrows.sf-navbar ul>li:hover>.sf-with-ul:after,.sf-arrows.sf-navbar ul>.sfHover>.sf-with-ul:after{border-color:transparent;border-top-color:white}
@@ -0,0 +1,37 @@
/* adding sf-vertical class in addition to sf-menu creates a vertical menu */
/* eg. <ul class="sf-menu sf-vertical"> ... */
.sf-vertical {
width: 12em;
/* If you want the width of the closed menu to expand to its
widest top-level menu item (like its "Supersubs" submenus do),
replace the width rule above with the following two rules. */
/*
min-width: 12em;
*width: 12em;
*/
}
.sf-vertical ul {
left: 100%;
top: 0;
}
.sf-vertical > li {
float: none;
}
.sf-vertical li {
width: 100%;
}
/*** alter arrow directions ***/
.sf-vertical.sf-arrows > li > .sf-with-ul:after {
margin-top: -5px;
margin-right: -3px;
border-color: transparent;
border-left-color: #dFeEFF; /* edit this to suit design (no rgba in IE8) */
border-left-color: rgba(255,255,255,.5);
}
.sf-vertical.sf-arrows li > .sf-with-ul:focus:after,
.sf-vertical.sf-arrows li:hover > .sf-with-ul:after,
.sf-vertical.sf-arrows .sfHover > .sf-with-ul:after {
border-left-color: white;
}
+1
View File
@@ -0,0 +1 @@
.sf-vertical{width:12em}.sf-vertical ul{left:100%;top:0}.sf-vertical>li{float:none}.sf-vertical li{width:100%}.sf-vertical.sf-arrows>li>.sf-with-ul:after{margin-top:-5px;margin-right:-3px;border-color:transparent;border-left-color:#dfeeff;border-left-color:rgba(255,255,255,.5)}.sf-vertical.sf-arrows li>.sf-with-ul:focus:after,.sf-vertical.sf-arrows li:hover>.sf-with-ul:after,.sf-vertical.sf-arrows .sfHover>.sf-with-ul:after{border-left-color:white}
+113
View File
@@ -0,0 +1,113 @@
/*** ESSENTIAL STYLES ***/
.sf-menu, .sf-menu * {
margin: 0;
padding: 0;
list-style: none;
}
.sf-menu li {
position: relative;
}
.sf-menu ul {
position: absolute;
display: none;
top: 100%;
left: 0;
z-index: 99;
}
.sf-menu > li {
float: left;
}
.sf-menu li:hover > ul,
.sf-menu li.sfHover > ul {
display: block;
}
.sf-menu a {
display: block;
position: relative;
}
.sf-menu ul ul {
top: 0;
left: 100%;
}
/*** DEMO SKIN ***/
.sf-menu {
float: left;
margin-bottom: 1em;
}
.sf-menu ul {
box-shadow: 2px 2px 6px rgba(0,0,0,.2);
min-width: 12em; /* allow long menu items to determine submenu width */
*width: 12em; /* no auto sub width for IE7, see white-space comment below */
}
.sf-menu a {
border-left: 1px solid #fff;
border-top: 1px solid #dFeEFF; /* fallback colour must use full shorthand */
border-top: 1px solid rgba(255,255,255,.5);
padding: .75em 1em;
text-decoration: none;
zoom: 1; /* IE7 */
}
.sf-menu a {
color: #13a;
}
.sf-menu li {
background: #BDD2FF;
white-space: nowrap; /* no need for Supersubs plugin */
*white-space: normal; /* ...unless you support IE7 (let it wrap) */
-webkit-transition: background .2s;
transition: background .2s;
}
.sf-menu ul li {
background: #AABDE6;
}
.sf-menu ul ul li {
background: #9AAEDB;
}
.sf-menu li:hover,
.sf-menu li.sfHover {
background: #CFDEFF;
/* only transition out, not in */
-webkit-transition: none;
transition: none;
}
/*** arrows (for all except IE7) **/
.sf-arrows .sf-with-ul {
padding-right: 2.5em;
*padding-right: 1em; /* no CSS arrows for IE7 (lack pseudo-elements) */
}
/* styling for both css and generated arrows */
.sf-arrows .sf-with-ul:after {
content: '';
position: absolute;
top: 50%;
right: 1em;
margin-top: -3px;
height: 0;
width: 0;
/* order of following 3 rules important for fallbacks to work */
border: 5px solid transparent;
border-top-color: #dFeEFF; /* edit this to suit design (no rgba in IE8) */
border-top-color: rgba(255,255,255,.5);
}
.sf-arrows > li > .sf-with-ul:focus:after,
.sf-arrows > li:hover > .sf-with-ul:after,
.sf-arrows > .sfHover > .sf-with-ul:after {
border-top-color: white; /* IE8 fallback colour */
}
/* styling for right-facing arrows */
.sf-arrows ul .sf-with-ul:after {
margin-top: -5px;
margin-right: -3px;
border-color: transparent;
border-left-color: #dFeEFF; /* edit this to suit design (no rgba in IE8) */
border-left-color: rgba(255,255,255,.5);
}
.sf-arrows ul li > .sf-with-ul:focus:after,
.sf-arrows ul li:hover > .sf-with-ul:after,
.sf-arrows ul .sfHover > .sf-with-ul:after {
border-left-color: white;
}
+257
View File
@@ -0,0 +1,257 @@
/*
* Superfish v1.7.3 - jQuery menu widget
* Copyright (c) 2013 Joel Birch
*
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*/
;(function($) {
"use strict";
var methods = (function(){
// private properties and methods go here
var c = {
bcClass: 'sf-breadcrumb',
menuClass: 'sf-js-enabled',
anchorClass: 'sf-with-ul',
menuArrowClass: 'sf-arrows'
},
ios = (function(){
var ios = /iPhone|iPad|iPod/i.test(navigator.userAgent);
if (ios) {
// iOS clicks only bubble as far as body children
$(window).load(function() {
$('body').children().on('click', $.noop);
});
}
return ios;
})(),
wp7 = (function() {
var style = document.documentElement.style;
return ('behavior' in style && 'fill' in style && /iemobile/i.test(navigator.userAgent));
})(),
toggleMenuClasses = function($menu, o) {
var classes = c.menuClass;
if (o.cssArrows) {
classes += ' ' + c.menuArrowClass;
}
$menu.toggleClass(classes);
},
setPathToCurrent = function($menu, o) {
return $menu.find('li.' + o.pathClass).slice(0, o.pathLevels)
.addClass(o.hoverClass + ' ' + c.bcClass)
.filter(function() {
return ($(this).children(o.popUpSelector).hide().show().length);
}).removeClass(o.pathClass);
},
toggleAnchorClass = function($li) {
$li.children('a').toggleClass(c.anchorClass);
},
toggleTouchAction = function($menu) {
var touchAction = $menu.css('ms-touch-action');
touchAction = (touchAction === 'pan-y') ? 'auto' : 'pan-y';
$menu.css('ms-touch-action', touchAction);
},
applyHandlers = function($menu,o) {
var targets = 'li:has(' + o.popUpSelector + ')';
if ($.fn.hoverIntent && !o.disableHI) {
$menu.hoverIntent(over, out, targets);
}
else {
$menu
.on('mouseenter.superfish', targets, over)
.on('mouseleave.superfish', targets, out);
}
var touchevent = 'MSPointerDown.superfish';
if (!ios) {
touchevent += ' touchend.superfish';
}
if (wp7) {
touchevent += ' mousedown.superfish';
}
$menu
.on('focusin.superfish', 'li', over)
.on('focusout.superfish', 'li', out)
.on(touchevent, 'a', o, touchHandler);
},
touchHandler = function(e) {
var $this = $(this),
$ul = $this.siblings(e.data.popUpSelector);
if ($ul.length > 0 && $ul.is(':hidden')) {
$this.one('click.superfish', false);
if (e.type === 'MSPointerDown') {
$this.trigger('focus');
} else {
$.proxy(over, $this.parent('li'))();
}
}
},
over = function() {
var $this = $(this),
o = getOptions($this);
clearTimeout(o.sfTimer);
$this.siblings().superfish('hide').end().superfish('show');
},
out = function() {
var $this = $(this),
o = getOptions($this);
if (ios) {
$.proxy(close, $this, o)();
}
else {
clearTimeout(o.sfTimer);
o.sfTimer = setTimeout($.proxy(close, $this, o), o.delay);
}
},
close = function(o) {
o.retainPath = ( $.inArray(this[0], o.$path) > -1);
this.superfish('hide');
if (!this.parents('.' + o.hoverClass).length) {
o.onIdle.call(getMenu(this));
if (o.$path.length) {
$.proxy(over, o.$path)();
}
}
},
getMenu = function($el) {
return $el.closest('.' + c.menuClass);
},
getOptions = function($el) {
return getMenu($el).data('sf-options');
};
return {
// public methods
hide: function(instant) {
if (this.length) {
var $this = this,
o = getOptions($this);
if (!o) {
return this;
}
var not = (o.retainPath === true) ? o.$path : '',
$ul = $this.find('li.' + o.hoverClass).add(this).not(not).removeClass(o.hoverClass).children(o.popUpSelector),
speed = o.speedOut;
if (instant) {
$ul.show();
speed = 0;
}
o.retainPath = false;
o.onBeforeHide.call($ul);
$ul.stop(true, true).animate(o.animationOut, speed, function() {
var $this = $(this);
o.onHide.call($this);
});
}
return this;
},
show: function() {
var o = getOptions(this);
if (!o) {
return this;
}
var $this = this.addClass(o.hoverClass),
$ul = $this.children(o.popUpSelector);
o.onBeforeShow.call($ul);
$ul.stop(true, true).animate(o.animation, o.speed, function() {
o.onShow.call($ul);
});
return this;
},
destroy: function() {
return this.each(function(){
var $this = $(this),
o = $this.data('sf-options'),
$hasPopUp;
if (!o) {
return false;
}
$hasPopUp = $this.find(o.popUpSelector).parent('li');
clearTimeout(o.sfTimer);
toggleMenuClasses($this, o);
toggleAnchorClass($hasPopUp);
toggleTouchAction($this);
// remove event handlers
$this.off('.superfish').off('.hoverIntent');
// clear animation's inline display style
$hasPopUp.children(o.popUpSelector).attr('style', function(i, style){
return style.replace(/display[^;]+;?/g, '');
});
// reset 'current' path classes
o.$path.removeClass(o.hoverClass + ' ' + c.bcClass).addClass(o.pathClass);
$this.find('.' + o.hoverClass).removeClass(o.hoverClass);
o.onDestroy.call($this);
$this.removeData('sf-options');
});
},
init: function(op){
return this.each(function() {
var $this = $(this);
if ($this.data('sf-options')) {
return false;
}
var o = $.extend({}, $.fn.superfish.defaults, op),
$hasPopUp = $this.find(o.popUpSelector).parent('li');
o.$path = setPathToCurrent($this, o);
$this.data('sf-options', o);
toggleMenuClasses($this, o);
toggleAnchorClass($hasPopUp);
toggleTouchAction($this);
applyHandlers($this, o);
$hasPopUp.not('.' + c.bcClass).superfish('hide',true);
o.onInit.call(this);
});
}
};
})();
$.fn.superfish = function(method, args) {
if (methods[method]) {
return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
}
else if (typeof method === 'object' || ! method) {
return methods.init.apply(this, arguments);
}
else {
return $.error('Method ' + method + ' does not exist on jQuery.fn.superfish');
}
};
$.fn.superfish.defaults = {
popUpSelector: 'ul,.sf-mega', // within menu context
hoverClass: 'sfHover',
pathClass: 'overrideThisToUse',
pathLevels: 1,
delay: 800,
animation: {opacity:'show'},
animationOut: {opacity:'hide'},
speed: 'normal',
speedOut: 'fast',
cssArrows: true,
disableHI: false,
onInit: $.noop,
onBeforeShow: $.noop,
onShow: $.noop,
onBeforeHide: $.noop,
onHide: $.noop,
onIdle: $.noop,
onDestroy: $.noop
};
// soon to be deprecated
$.fn.extend({
hideSuperfishUl: methods.hide,
showSuperfishUl: methods.show
});
})(jQuery);
+1
View File
@@ -0,0 +1 @@
.sf-menu,.sf-menu *{margin:0;padding:0;list-style:none}.sf-menu li{position:relative}.sf-menu ul{position:absolute;display:none;top:100%;left:0;z-index:99}.sf-menu>li{float:left}.sf-menu li:hover>ul,.sf-menu li.sfHover>ul{display:block}.sf-menu a{display:block;position:relative}.sf-menu ul ul{top:0;left:100%}.sf-menu{float:left;margin-bottom:1em}.sf-menu ul{box-shadow:2px 2px 6px rgba(0,0,0,.2);min-width:12em;*width:12em}.sf-menu a{border-left:1px solid #fff;border-top:1px solid #dfeeff;border-top:1px solid rgba(255,255,255,.5);padding:.75em 1em;text-decoration:none;zoom:1}.sf-menu a{color:#13a}.sf-menu li{background:#bdd2ff;white-space:nowrap;*white-space:normal;-webkit-transition:background .2s;transition:background .2s}.sf-menu ul li{background:#aabde6}.sf-menu ul ul li{background:#9aaedb}.sf-menu li:hover,.sf-menu li.sfHover{background:#cfdeff;-webkit-transition:none;transition:none}.sf-arrows .sf-with-ul{padding-right:2.5em;*padding-right:1em}.sf-arrows .sf-with-ul:after{content:'';position:absolute;top:50%;right:1em;margin-top:-3px;height:0;width:0;border:5px solid transparent;border-top-color:#dfeeff;border-top-color:rgba(255,255,255,.5)}.sf-arrows>li>.sf-with-ul:focus:after,.sf-arrows>li:hover>.sf-with-ul:after,.sf-arrows>.sfHover>.sf-with-ul:after{border-top-color:white}.sf-arrows ul .sf-with-ul:after{margin-top:-5px;margin-right:-3px;border-color:transparent;border-left-color:#dfeeff;border-left-color:rgba(255,255,255,.5)}.sf-arrows ul li>.sf-with-ul:focus:after,.sf-arrows ul li:hover>.sf-with-ul:after,.sf-arrows ul .sfHover>.sf-with-ul:after{border-left-color:white}
+1
View File
@@ -0,0 +1 @@
(function(a){"use strict";var b=function(){var b={bcClass:"sf-breadcrumb",menuClass:"sf-js-enabled",anchorClass:"sf-with-ul",menuArrowClass:"sf-arrows"},c=function(){var b=/iPhone|iPad|iPod/i.test(navigator.userAgent);return b&&a(window).load(function(){a("body").children().on("click",a.noop)}),b}(),d=function(){var a=document.documentElement.style;return"behavior"in a&&"fill"in a&&/iemobile/i.test(navigator.userAgent)}(),e=function(a,c){var d=b.menuClass;c.cssArrows&&(d+=" "+b.menuArrowClass),a.toggleClass(d)},f=function(c,d){return c.find("li."+d.pathClass).slice(0,d.pathLevels).addClass(d.hoverClass+" "+b.bcClass).filter(function(){return a(this).children(d.popUpSelector).hide().show().length}).removeClass(d.pathClass)},g=function(a){a.children("a").toggleClass(b.anchorClass)},h=function(a){var b=a.css("ms-touch-action");b="pan-y"===b?"auto":"pan-y",a.css("ms-touch-action",b)},i=function(b,e){var f="li:has("+e.popUpSelector+")";a.fn.hoverIntent&&!e.disableHI?b.hoverIntent(k,l,f):b.on("mouseenter.superfish",f,k).on("mouseleave.superfish",f,l);var g="MSPointerDown.superfish";c||(g+=" touchend.superfish"),d&&(g+=" mousedown.superfish"),b.on("focusin.superfish","li",k).on("focusout.superfish","li",l).on(g,"a",e,j)},j=function(b){var c=a(this),d=c.siblings(b.data.popUpSelector);d.length>0&&d.is(":hidden")&&(c.one("click.superfish",!1),"MSPointerDown"===b.type?c.trigger("focus"):a.proxy(k,c.parent("li"))())},k=function(){var b=a(this),c=o(b);clearTimeout(c.sfTimer),b.siblings().superfish("hide").end().superfish("show")},l=function(){var b=a(this),d=o(b);c?a.proxy(m,b,d)():(clearTimeout(d.sfTimer),d.sfTimer=setTimeout(a.proxy(m,b,d),d.delay))},m=function(b){b.retainPath=a.inArray(this[0],b.$path)>-1,this.superfish("hide"),this.parents("."+b.hoverClass).length||(b.onIdle.call(n(this)),b.$path.length&&a.proxy(k,b.$path)())},n=function(a){return a.closest("."+b.menuClass)},o=function(a){return n(a).data("sf-options")};return{hide:function(b){if(this.length){var c=this,d=o(c);if(!d)return this;var e=d.retainPath===!0?d.$path:"",f=c.find("li."+d.hoverClass).add(this).not(e).removeClass(d.hoverClass).children(d.popUpSelector),g=d.speedOut;b&&(f.show(),g=0),d.retainPath=!1,d.onBeforeHide.call(f),f.stop(!0,!0).animate(d.animationOut,g,function(){var b=a(this);d.onHide.call(b)})}return this},show:function(){var a=o(this);if(!a)return this;var b=this.addClass(a.hoverClass),c=b.children(a.popUpSelector);return a.onBeforeShow.call(c),c.stop(!0,!0).animate(a.animation,a.speed,function(){a.onShow.call(c)}),this},destroy:function(){return this.each(function(){var f,c=a(this),d=c.data("sf-options");return d?(f=c.find(d.popUpSelector).parent("li"),clearTimeout(d.sfTimer),e(c,d),g(f),h(c),c.off(".superfish").off(".hoverIntent"),f.children(d.popUpSelector).attr("style",function(a,b){return b.replace(/display[^;]+;?/g,"")}),d.$path.removeClass(d.hoverClass+" "+b.bcClass).addClass(d.pathClass),c.find("."+d.hoverClass).removeClass(d.hoverClass),d.onDestroy.call(c),c.removeData("sf-options"),void 0):!1})},init:function(c){return this.each(function(){var d=a(this);if(d.data("sf-options"))return!1;var j=a.extend({},a.fn.superfish.defaults,c),k=d.find(j.popUpSelector).parent("li");j.$path=f(d,j),d.data("sf-options",j),e(d,j),g(k),h(d),i(d,j),k.not("."+b.bcClass).superfish("hide",!0),j.onInit.call(this)})}}}();a.fn.superfish=function(c){return b[c]?b[c].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof c&&c?a.error("Method "+c+" does not exist on jQuery.fn.superfish"):b.init.apply(this,arguments)},a.fn.superfish.defaults={popUpSelector:"ul,.sf-mega",hoverClass:"sfHover",pathClass:"overrideThisToUse",pathLevels:1,delay:800,animation:{opacity:"show"},animationOut:{opacity:"hide"},speed:"normal",speedOut:"fast",cssArrows:!0,disableHI:!1,onInit:a.noop,onBeforeShow:a.noop,onShow:a.noop,onBeforeHide:a.noop,onHide:a.noop,onIdle:a.noop,onDestroy:a.noop},a.fn.extend({hideSuperfishUl:b.hide,showSuperfishUl:b.show})})(jQuery);
+26
View File
@@ -0,0 +1,26 @@
{
"name": "superfish",
"filename": "superfish.min.js",
"version": "1.7.3",
"description": "Superfish is an enhanced Suckerfish-style menu jQuery plugin that takes an existing pure CSS drop-down menu (so it degrades gracefully without JavaScript) and adds much-sought-after enhancements.",
"homepage": "http://users.tpg.com.au/j_birch/",
"keywords": [
"dropdown",
"jquery",
"menu",
"superfish",
"super fish"
],
"maintainers": [
{
"name": "Joel Birch",
"web": "http://users.tpg.com.au/j_birch/"
}
],
"repositories": [
{
"type": "git",
"url": "https://github.com/joeldbirch/superfish"
}
]
}