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