1/** 2* @package qt-megamenu 3*/ 4 5(function($) { 6 "use strict"; 7 8 $.qtMegaMenuObj = { 9 body: $("body"), 10 window: $(window), 11 document: $(document), 12 htmlAndbody: $('html,body'), 13 highPerfScroll: true, 14 /** 15 * ======================================================================================================================================== | 16 * | 17 * | 18 * START PLUGIN FUNCTIONS | 19 * | 20 * | 21 * ======================================================================================================================================== | 22 */ 23 fn: { 24 MMactivate: function() { 25 $('[class*=qt-megamenu-is-]').each(function(i,c) { 26 27 var that, // menu item 28 classes, // classes of the menu item 29 megamenu_id, // id of the megamenu post 30 posY, // position where we need to place the megamenu content 31 content, // html content 32 megamenu_item, 33 megacontent, // item of the megamenu 34 animInterval; // delay opening 35 36 that = $(c); 37 that.find('ul').css({'display':'none'}); 38 classes = that.attr('class').split(' '); 39 // get the ID of the megamenu 40 megamenu_id = $.grep(classes, function(elem) { 41 return elem.toLowerCase().indexOf('qt-megamenu-is-') > -1; 42 }); 43 if(megamenu_id.length > 0){ 44 megamenu_id = megamenu_id[0].split('qt-megamenu-is-').join(''); 45 } 46 if('undefined' === typeof(megamenu_id) || "" === megamenu_id){ 47 return; 48 } 49 50 megamenu_item = $('#qt-megamenu-item-' + megamenu_id); 51 if(megamenu_item.hasClass('qt-megamenu-isset')){ 52 return; 53 } 54 megamenu_item.addClass('qt-megamenu-isset'); 55 that.attr('data-megamenu', megamenu_id); 56 /// ================== INTERACTIVITY HERE ==================== 57 megacontent = $('#qt-megamenu-item-' + that.data('megamenu') ); 58 that.on('click', function(e){ 59 e.preventDefault(); 60 return false; 61 }); 62 that.on('mouseenter, mouseover', function(){ 63 if(animInterval !== false){ 64 clearTimeout(animInterval); 65 } 66 animInterval = setTimeout( 67 function(){ 68 megacontent.addClass('open'); 69 } 70 , 160 71 ); 72 }); 73 that.on('mouseleave', function(){ 74 if(animInterval !== false){ 75 clearTimeout(animInterval); 76 } 77 animInterval = setTimeout( 78 function(){ 79 megacontent.removeClass('open'); 80 } 81 , 200 82 ); 83 }); 84 megacontent.on('mouseenter', function(){ 85 if(animInterval !== false){ 86 clearTimeout(animInterval); 87 } 88 animInterval = setTimeout( 89 function(){ 90 megacontent.addClass('open'); 91 } 92 , 160 93 ); 94 }); 95 megacontent.on('mouseleave', function(){ 96 if(animInterval !== false){ 97 clearTimeout(animInterval); 98 } 99 animInterval = setTimeout( 100 function(){ 101 megacontent.removeClass('open'); 102 } 103 , 500 104 ); 105 }); 106 }); 107 }, 108 109 /**==================================================================== 110 * 111 * 112 * Functions to run once on first page load 113 * 114 * 115 ====================================================================*/ 116 init: function() { 117 var f = $.qtMegaMenuObj.fn; 118 f.MMactivate(); 119 }, 120 } 121 /** 122 * ======================================================================================================================================== | 123 * | 124 * | 125 * END PLUGIN FUNCTIONS | 126 * | 127 * | 128 * ======================================================================================================================================== | 129 */ 130 }; 131 132 /**==================================================================== 133 * 134 * Page Ready Trigger 135 * 136 ====================================================================*/ 137 jQuery(document).ready(function() { 138 $.qtMegaMenuObj.fn.init(); 139 }); 140})(jQuery); 141 142 143 144 145
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.