|
14 | 14 | */ |
15 | 15 |
|
16 | 16 | (function($){ |
17 | | - $.fn.superfish = function(op){ |
| 17 | + $.fn.superfish = function(options){ |
18 | 18 | var sf = $.fn.superfish, |
19 | 19 | c = sf.c, |
20 | 20 | $arrow = $(['<span class="',c.arrowClass,'"> »</span>'].join('')), |
|
26 | 26 | out = function(){ |
27 | 27 | var $$ = $(this), menu = getMenu($$), o = sf.op; |
28 | 28 | clearTimeout(menu.sfTimer); |
29 | | - menu.sfTimer=setTimeout(function(){ |
| 29 | + menu.sfTimer = setTimeout(function(){ |
30 | 30 | if ($$.children('.sf-clicked').length == 0){ |
31 | | - o.retainPath=($.inArray($$[0],o.$path)>-1); |
| 31 | + o.retainPath = ($.inArray($$[0],o.$path)>-1); |
32 | 32 | $$.hideSuperfishUl(); |
33 | | - if (o.$path.length && $$.parents(['li.',o.hoverClass].join('')).length<1){over.call(o.$path);} |
| 33 | + if (o.$path.length && $$.parents(['li.',o.hoverClass].join('')).length < 1){ |
| 34 | + over.call(o.$path); |
| 35 | + } |
34 | 36 | } |
35 | 37 | },o.delay); |
36 | 38 | }, |
|
43 | 45 |
|
44 | 46 | return this.each(function() { |
45 | 47 | var s = this.serial = sf.o.length; |
46 | | - var o = $.extend({},sf.defaults,op); |
47 | | - o.$path = $('li.'+o.pathClass,this).slice(0,o.pathLevels); |
| 48 | + var o= $.extend({},sf.defaults,options); |
| 49 | + o.$path = $('li.' + o.pathClass,this).slice(0,o.pathLevels); |
48 | 50 | var p = o.$path; |
49 | 51 | for (var l = 0; l < p.length; l++){ |
50 | 52 | p.eq(l).addClass([o.hoverClass,c.bcClass].join(' ')).filter('li:has(ul)').removeClass(o.pathClass); |
|
54 | 56 | $('li:has(ul)',this)[($.fn.hoverIntent && !o.disableHI) ? 'hoverIntent' : 'hover'](over,out).each(function() { |
55 | 57 | if (o.autoArrows) addArrow( $(this).children('a:first-child, span.nolink:first-child') ); |
56 | 58 | }) |
57 | | - .not('.'+c.bcClass) |
58 | | - .hideSuperfishUl(); |
| 59 | + .not('.' + c.bcClass).hideSuperfishUl(); |
59 | 60 |
|
60 | 61 | var $a = $('a, span.nolink',this); |
61 | 62 | $a.each(function(i){ |
|
89 | 90 | pathClass: 'overideThisToUse', |
90 | 91 | pathLevels: 1, |
91 | 92 | delay: 800, |
92 | | - animation: {opacity:'show'}, |
| 93 | + animation: {opacity: 'show'}, |
93 | 94 | speed: 'fast', |
94 | 95 | autoArrows: true, |
95 | 96 | dropShadows: true, |
|
101 | 102 | }; |
102 | 103 | $.fn.extend({ |
103 | 104 | hideSuperfishUl : function(){ |
104 | | - var o = sf.op, |
105 | | - not = (o.retainPath===true) ? o.$path : ''; |
| 105 | + var o = sf.op; |
| 106 | + var not = (o.retainPath === true) ? o.$path : ''; |
106 | 107 | o.retainPath = false; |
107 | 108 | var $ul = $(['li.',o.hoverClass].join(''),this).add(this).not(not).removeClass(o.hoverClass) |
108 | 109 | .children('ul').addClass('sf-hidden'); |
|
111 | 112 | }, |
112 | 113 | showSuperfishUl : function(){ |
113 | 114 | var o = sf.op, |
114 | | - sh = sf.c.shadowClass+'-off', |
115 | | - $ul = this.addClass(o.hoverClass) |
116 | | - .children('ul.sf-hidden').hide().removeClass('sf-hidden'); |
| 115 | + sh = sf.c.shadowClass + '-off', |
| 116 | + $ul = this.addClass(o.hoverClass).children('ul.sf-hidden').hide().removeClass('sf-hidden'); |
117 | 117 | o.onBeforeShow.call($ul); |
118 | | - $ul.animate(o.animation,o.speed,function(){ o.onShow.call($ul); }); |
| 118 | + $ul.animate(o.animation, o.speed, function(){ o.onShow.call($ul); }); |
119 | 119 | return this; |
120 | 120 | } |
121 | 121 | }); |
|
0 commit comments