1/** 2 * @package WordPress Plugin 3 * @subpackage CMSMasters Mega Menu 4 * @version 1.2.4 5 * 6 * Mega Menu Script 7 * Created by CMSMasters 8 * 9 */ 10 11 12var header = jQuery('#header .header_mid_inner'), 13 nav = jQuery('#navigation'), 14 nav_left = nav.offset().left, 15 mega = nav.find('> li.menu-item-mega'), 16 header_width = header.width(), 17 firstRun = true, 18 rtl = jQuery('html').attr('dir'); 19 20 21jQuery(document).ready(function() { 22 cmsmastersMegaMenu(); 23} ); 24 25 26jQuery(window).on('debouncedresize', function () { 27 cmsmastersMegaMenu(); 28 29 30 header_width = header.width(); 31} ); 32 33 34jQuery(window).on('debouncedscroll', function () { 35 cmsmastersMegaMenu(); 36} ); 37 38 39function cmsmastersMegaMenu() { 40 var win_width = jQuery(window).width(), 41 new_header_width = header.width(), 42 header_pad_left = Number(header.css('padding-left').replace('px', '')), 43 header_left = header.offset().left + header_pad_left, 44 header_right = header_left + new_header_width, 45 new_nav_left = nav.offset().left; 46 47 48 if ( 49 firstRun || 50 new_header_width !== header_width || 51 new_nav_left !== nav_left 52 ) { 53 mega.each(function () { 54 var li = jQuery(this), 55 full = li.hasClass('menu-item-mega-fullwidth'), 56 drop_right = li.hasClass('menu-item-dropdown-right'), 57 li_left = li.offset().left, 58 mega = li.find('> div'); 59 60 61 if (mega.length === 1) { 62 var mega_width = mega.outerWidth(), 63 mega_left = mega.offset().left, 64 mega_right = mega_left + mega_width; 65 66 67 if (full) { 68 mega.css( { 69 width : new_header_width + 'px', 70 right : 'auto', 71 left : '-' + (li_left - header_left) + 'px' 72 } ); 73 } else { 74 if (mega_width >= new_header_width) { 75 li.addClass('menu-item-mega-fullwidth menu-item-mega-dynamic-fullwidth').find('> div').css( { 76 width : new_header_width + 'px', 77 right : 'auto', 78 left : '-' + ((typeof(rtl) === 'undefined') ? (li_left - header_left) : (mega_right - header_right)) + 'px' 79 } ); 80 } else { 81 if (drop_right) { 82 if (typeof(rtl) === 'undefined') { 83 if (mega_left < header_left) { 84 mega.css( { 85 right : 'auto', 86 left : '-' + (li_left - header_left) + 'px' 87 } ); 88 } 89 } else { 90 if (mega_right > header_right) { 91 mega.css( { 92 left : '-' + (mega_right - header_right) + 'px' 93 } ); 94 } 95 } 96 } else { 97 if (typeof(rtl) === 'undefined') { 98 if (mega_right > header_right) { 99 mega.css( { 100 left : '-' + (mega_right - header_right) + 'px' 101 } ); 102 } else if (mega_left < header_left) { 103 mega.css( { 104 left : '-' + (li_left - header_left) + 'px' 105 } ); 106 } 107 } else { 108 if (mega_left < header_left) { 109 mega.css( { 110 right : 'auto', 111 left : '-' + (li_left - header_left) + 'px' 112 } ); 113 } 114 } 115 } 116 } 117 } 118 119 120 if (win_width < 1008) { 121 mega.css( { 122 width : '', 123 right : '', 124 left : '' 125 } ); 126 127 128 mega.find('a').each(function () { 129 var a_style = jQuery(this).attr('style'), 130 span_tag = jQuery(this).find('span'); 131 132 133 jQuery(this).removeAttr('style').attr('data-style', a_style); 134 135 136 span_tag.each(function () { 137 var span_style = jQuery(this).attr('style'); 138 139 140 jQuery(this).removeAttr('style').attr('data-style', span_style); 141 } ); 142 } ); 143 } else { 144 mega.find('a').each(function () { 145 var a_style = jQuery(this).attr('data-style'), 146 span_tag = jQuery(this).find('span'); 147 148 149 jQuery(this).removeAttr('data-style').attr('style', a_style); 150 151 152 span_tag.each(function () { 153 var span_style = jQuery(this).attr('data-style'); 154 155 156 jQuery(this).removeAttr('data-style').attr('style', span_style); 157 } ); 158 } ); 159 } 160 } 161 } ); 162 163 164 nav_left = new_nav_left; 165 } 166 167 168 firstRun = false; 169} 170 171 172function cmsmastersMegaMenuDestroy() { 173 mega.each(function () { 174 var li = jQuery(this), 175 mega = li.find('> div'); 176 177 178 mega.css( { 179 width : '', 180 right : '', 181 left : '' 182 } ); 183 } ); 184 185 186 firstRun = true; 187} 188
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.