1;;; 2/* 3 * Function for Mega Main Menu. 4 */ 5;jQuery(document).ready(function(){ 6 7 /* 8 * Unbinded all previous JS actions with menu. 9 */ 10 ;jQuery( '#mega_main_menu, #mega_main_menu *' ).unbind(); 11 12 /* 13 * Mobile toggle menu 14 */ 15 ;jQuery( '.mobile_toggle' ).click(function() { 16 jQuery( this ).parent().toggleClass( 'mobile_menu_active' ); 17 jQuery( '#mega_main_menu .mobile_active_parent' ).removeClass('mobile_active_parent'); 18 }); 19 20 21 22 /* 23 * Mobile Double tap to go 24 */ 25 ;(function( $, window, document, undefined ) 26 { 27 $.fn.doubleTapToGo = function( params ) 28 { 29 if( !( 'ontouchstart' in window ) && 30 /* 31 !navigator.msMaxTouchPoints && 32 !/Android|webOS|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) 33 !/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) 34 */ 35 !/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini/i.test(navigator.userAgent) 36 ) { return false; } 37 this.each( function() 38 { 39 var curItem = false; 40 41 $( this ).on( 'click', function( e ) 42 { 43 jQuery( '#mega_main_menu .mobile_active_parent' ).removeClass( 'mobile_active_parent' ); 44 jQuery( this ).addClass('mobile_active_parent'); 45 if( /iPhone|iPad|iPod/i.test(navigator.userAgent) ) { 46 return false; 47 } 48 var item = $( this ); 49 if( item[ 0 ] != curItem[ 0 ] ) 50 { 51 e.preventDefault(); 52 curItem = item; 53 } 54 }); 55 56 $( document ).on( 'click touchstart MSPointerDown', function( e ) 57 { 58 var resetItem = true, 59 parents = $( e.target ).parents(); 60 61 for( var i = 0; i < parents.length; i++ ) 62 if( parents[ i ] == curItem[ 0 ] ) 63 resetItem = false; 64 65 if( resetItem ) 66 curItem = false; 67 }); 68 }); 69 return this; 70 }; 71 })( jQuery, window, document ); 72 ;jQuery( '#mega_main_menu li:has(ul)' ).doubleTapToGo(); 73 74 /* 75 * Sticky menu 76 */ 77 ;jQuery( '#mega_main_menu > .menu_holder' ).each(function(index,element){ 78 79 var stickyoffset = []; 80 var menu_inner_width = []; 81 var menu_inner = []; 82 var style_attr = []; 83 menu_inner[ index ] = jQuery( element ).find( '.menu_inner' ); 84 stickyoffset[ index ] = jQuery( element ).data( 'stickyoffset' ) * 1; 85 86 if ( jQuery( element ).attr( 'data-sticky' ) == '1' && stickyoffset[ index ] == 0 ) { 87 menu_inner_width[ index ] = menu_inner[ index ].width(); 88 menu_inner[ index ].attr( 'style' , 'width:' + menu_inner_width[ index ] + 'px;' ); 89 jQuery( element ).addClass( 'sticky_container' ); 90 } else { 91 ;jQuery(window).on('scroll', function(){ 92 if ( jQuery( element ).attr( 'data-sticky' ) == '1' ) { 93 scrollpath = jQuery(window).scrollTop(); 94 if ( scrollpath > stickyoffset[ index ] ) { 95 if ( !jQuery( element ).hasClass( 'sticky_container' ) ) { 96 menu_inner_width[ index ] = menu_inner[ index ].width(); 97 jQuery( element ).find( '.menu_inner' ).attr( 'style' , 'width:' + menu_inner_width[ index ] + 'px;' ); 98 jQuery( element ).addClass( 'sticky_container' ); 99 } 100 } else { 101 jQuery( element ).removeClass( 'sticky_container' ); 102 style_attr[ index ] = jQuery( menu_inner[ index ] ).attr( 'style' ); 103 if ( typeof style_attr[ index ] !== 'undefined' && style_attr[ index ] !== false ) { 104 menu_inner[ index ].removeAttr( 'style' ); 105 } 106 } 107 } else { 108 jQuery( element ).removeClass( 'sticky_container' ); 109 } 110 }); 111 } 112 }); 113 114 /* 115 * Smooth scroll to anchor link 116 */ 117 jQuery(function() { 118 jQuery('#mega_main_menu a[href*=#]:not([href=#])').click(function() { 119 if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) { 120 var target = jQuery(this.hash); 121 target = target.length ? target : jQuery('[name=' + this.hash.slice(1) +']'); 122 if (target.length) { 123 jQuery('html,body').animate({ 124 scrollTop: target.offset().top - 90 125 }, 600); 126 return false; 127 } 128 } 129 }); 130 }); 131 132 133});
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.