|
10 | 10 | */ |
11 | 11 | require(['jquery', 'easing'], function($, easing){ |
12 | 12 |
|
13 | | - !(function($){"use strict";$.fn.magicaccordion=function(options){var defaults={accordion:!0,mouseType:!1,speed:300,closedSign:'collapse',openedSign:'expand',openedActive:!1,};var methods={init:function(){return this.each(function(){var self=$(this);methods.menuLoad(self)})},menuLoad:function(self){var opts=$.extend(defaults,options);if(self.hasClass('menu-init'))return;self.addClass('menu-init');self.find("li").each(function(){if($(this).find("ul").length){$(this).find("ul").hide();$(this).find("a:first").after("<span class='"+opts.closedSign+"'>"+opts.closedSign+"</span>");if($(this).find("a:first").attr('href')=="#"){$(this).find("a:first").click(function(){return!1})}}});if(opts.openedActive){methods.openedActive(self)}if(opts.mouseType){self.find("li a").mouseenter(function(){methods.menuAction(self,$(this))})}else{self.find("li span").click(function(){methods.menuAction(self,$(this))})}var catplus=self.find('.nav-accordion >.level0:hidden').not('.all-cat');if(catplus.length){self.find('.all-cat').show().click(function(event){$(this).children().toggle();catplus.slideToggle('slow')})}else{self.find('.all-cat').hide()}},menuAction:function(self,item){var opts=$.extend(defaults,options);var parent=item.parent();if(parent.find("ul").length){if(opts.accordion){if(!parent.find("ul").is(':visible')){var parents=parent.parents("ul");var visible=self.find("ul:visible");visible.each(function(visibleIndex){var close=!0;parents.each(function(parentIndex){if(parents[parentIndex]==visible[visibleIndex]){close=!1;return!1}});if(close){if($(this).parent().find("ul")!=visible[visibleIndex]){$(visible[visibleIndex]).slideUp(opts.speed,function(){$(this).parent("li").find("a:first").next().html(opts.closedSign).addClass(opts.closedSign)})}}})}}var parentFirst=parent.find("ul:first");if(parentFirst.is(":visible")){parentFirst.slideUp(opts.speed,function(){$(this).parent("li").find("a:first").next().delay(opts.speed+1000).html(opts.closedSign).removeClass(opts.openedSign).addClass(opts.closedSign)})}else{parentFirst.slideDown(opts.speed,function(){$(this).parent("li").find("a:first").next().delay(opts.speed+1000).html(opts.openedSign).removeClass(opts.closedSign).addClass(opts.openedSign)})}}},openedActive:function(self){var opts=$.extend(defaults,options);self.find("li.active").each(function(){$(this).parents("ul").slideDown(opts.speed,opts.easing);$(this).parents("ul").parent("li").find("a:first").next().html(opts.openedSign).removeClass(opts.closedSign).addClass(opts.openedSign);$(this).find("ul:first").slideDown(opts.speed,opts.easing);$(this).find("a:first").next().html(opts.openedSign).removeClass(opts.closedSign).addClass(opts.openedSign)})}};if(methods[options]){return methods[options].apply(this,Array.prototype.slice.call(arguments,1))}else if(typeof options==='object'||!options){return methods.init.apply(this)}else{$.error('Method "'+method+'" does not exist in magicaccordion plugin!')}}})(jQuery); |
| 13 | + !(function($){"use strict";$.fn.magicaccordion=function(options){var defaults={accordion:!0,mouseType:!1,speed:300,closedSign:'collapse',openedSign:'expand',openedActive:!1,};var methods={init:function(){return this.each(function(){var self=$(this);methods.menuLoad(self)})},menuLoad:function(self){var opts=$.extend(defaults,options);if(self.hasClass('menu-init'))return;self.addClass('menu-init');self.find("li").each(function(){if($(this).find("ul").length){$(this).find("ul").hide();$(this).find("a:first").after("<span class='"+opts.closedSign+"'>"+opts.closedSign+"</span>");if($(this).find("a:first").attr('href')=="#"){$(this).find("a:first").on('click',function(){return!1})}}});if(opts.openedActive){methods.openedActive(self)}if(opts.mouseType){self.find("li a").mouseenter(function(){methods.menuAction(self,$(this))})}else{self.find("li span").on('click',function(){methods.menuAction(self,$(this))})}var catplus=self.find('.nav-accordion >.level0:hidden').not('.all-cat');if(catplus.length){self.find('.all-cat').show().on('click',function(event){$(this).children().toggle();catplus.slideToggle('slow')})}else{self.find('.all-cat').hide()}},menuAction:function(self,item){var opts=$.extend(defaults,options);var parent=item.parent();if(parent.find("ul").length){if(opts.accordion){if(!parent.find("ul").is(':visible')){var parents=parent.parents("ul");var visible=self.find("ul:visible");visible.each(function(visibleIndex){var close=!0;parents.each(function(parentIndex){if(parents[parentIndex]==visible[visibleIndex]){close=!1;return!1}});if(close){if($(this).parent().find("ul")!=visible[visibleIndex]){$(visible[visibleIndex]).slideUp(opts.speed,function(){$(this).parent("li").find("a:first").next().html(opts.closedSign).addClass(opts.closedSign)})}}})}}var parentFirst=parent.find("ul:first");if(parentFirst.is(":visible")){parentFirst.slideUp(opts.speed,function(){$(this).parent("li").find("a:first").next().delay(opts.speed+1000).html(opts.closedSign).removeClass(opts.openedSign).addClass(opts.closedSign)})}else{parentFirst.slideDown(opts.speed,function(){$(this).parent("li").find("a:first").next().delay(opts.speed+1000).html(opts.openedSign).removeClass(opts.closedSign).addClass(opts.openedSign)})}}},openedActive:function(self){var opts=$.extend(defaults,options);self.find("li.active").each(function(){$(this).parents("ul").slideDown(opts.speed,opts.easing);$(this).parents("ul").parent("li").find("a:first").next().html(opts.openedSign).removeClass(opts.closedSign).addClass(opts.openedSign);$(this).find("ul:first").slideDown(opts.speed,opts.easing);$(this).find("a:first").next().html(opts.openedSign).removeClass(opts.closedSign).addClass(opts.openedSign)})}};if(methods[options]){return methods[options].apply(this,Array.prototype.slice.call(arguments,1))}else if(typeof options==='object'||!options){return methods.init.apply(this)}else{$.error('Method "'+method+'" does not exist in magicaccordion plugin!')}}})(jQuery); |
14 | 14 | (function ($) { |
15 | 15 | "use strict"; |
16 | 16 | $.fn.magicmenu = function (options) { |
@@ -105,21 +105,22 @@ require(['jquery', 'easing'], function($, easing){ |
105 | 105 | var menuAIO = vmagicmenu.find('.nav-desktop'); |
106 | 106 | if(body.hasClass('cms-index-index') && menuAIO.length){ |
107 | 107 | heightItem = menuAIO.height(); |
108 | | - vmagicmenu.hover( |
109 | | - function() { heightAIO = menuAIO.height() ; menuAIO.addClass('over').css({"overflow": "", "height": 'auto', "display": ''}); }, |
110 | | - function() { menuAIO.removeClass('over').css({"overflow": "hidden", "height": heightAIO}); } |
111 | | - ); |
| 108 | + vmagicmenu.on('mouseenter', function() { |
| 109 | + heightAIO = menuAIO.height() ; menuAIO.addClass('over').css({"overflow": "", "height": 'auto', "display": ''}); |
| 110 | + }).on('mouseleave', function() { |
| 111 | + menuAIO.removeClass('over').css({"overflow": "hidden", "height": heightAIO}); |
| 112 | + }); |
112 | 113 | } |
113 | 114 | var header = $('header.page-header'); |
114 | 115 | header.css('min-height', menuHeight); |
115 | | - $(window).resize(function(){ |
| 116 | + $(window).on('resize', function(){ |
116 | 117 | if(!menuSticky.hasClass('header-container-fixed')){ |
117 | 118 | header.css('min-height', function(){ |
118 | 119 | return $(sticky).innerHeight(); |
119 | 120 | }); |
120 | 121 | } |
121 | 122 | }); |
122 | | - $(window).scroll(function () { |
| 123 | + $(window).on('scroll', function () { |
123 | 124 | var postion = $(this).scrollTop(); |
124 | 125 | $(this).trigger('magicmenu:refresh'); |
125 | 126 | if (postion > postionTop ){ /* not use = */ |
@@ -298,14 +299,14 @@ require(['jquery', 'easing'], function($, easing){ |
298 | 299 | }, |
299 | 300 |
|
300 | 301 | toggleVertical: function ($vmenu) { |
301 | | - $vmenu.find('.v-title').click(function() { |
| 302 | + $vmenu.find('.v-title').on('click', function() { |
302 | 303 | // $vmenu.find('.nav-desktop').parent().toggle(); |
303 | 304 | $vmenu.find('.nav-desktop').height('').slideToggle(400); |
304 | 305 | }); |
305 | 306 | var catplus = $vmenu.find('.nav-desktop > .level0:hidden').not('.all-cat'); |
306 | 307 | // var catmore = $vmenu.find('.nav-desktop > .level0'); |
307 | | - if(catplus.length) $vmenu.find('.all-cat').show().click(function(event) {$(this).children().toggle(); catplus.slideToggle('slow');}); |
308 | | - // if(catplus.length) $vmenu.find('.all-cat').show().click(function(event) {$(this).children().toggle(); catmore.slideToggle('slow');}); |
| 308 | + if(catplus.length) $vmenu.find('.all-cat').show().on('click', function(event) {$(this).children().toggle(); catplus.slideToggle('slow');}); |
| 309 | + // if(catplus.length) $vmenu.find('.all-cat').show().on('click', function(event) {$(this).children().toggle(); catmore.slideToggle('slow');}); |
309 | 310 | else $vmenu.find('.all-cat').hide(); |
310 | 311 | }, |
311 | 312 |
|
@@ -384,7 +385,7 @@ require(['jquery', 'easing'], function($, easing){ |
384 | 385 | } |
385 | 386 | }); |
386 | 387 |
|
387 | | - $(window).resize(function(){ $(this).trigger('magicmenu:refresh')}); |
| 388 | + $(window).on('resize', function(){ $(this).trigger('magicmenu:refresh')}); |
388 | 389 |
|
389 | 390 | methods.taphover(menu); |
390 | 391 | methods.active(menu); |
|
0 commit comments