1(function($) 2{ 3 "use strict"; 4 $.avia_utilities = $.avia_utilities || {}; 5 6 $(document).ready(function() 7 { 8 //activates the sticky submenu 9 $.avia_utilities = $.avia_utilities || {}; 10 if($.avia_utilities.avia_sticky_submenu) 11 $.avia_utilities.avia_sticky_submenu(); 12 }); 13 14 15 $.avia_utilities.avia_sticky_submenu = function() 16 { 17 var win = $(window), 18 html = $('html:first'), 19 header = $('.html_header_top.html_header_sticky #header'), 20 html_margin = parseInt( $('html:first').css('margin-top'), 10), 21 setWitdth = $('.html_header_sidebar #main, .boxed #main'), 22 menus = $('.av-submenu-container'), 23 bordermod = html.is('.html_minimal_header') ? 0 : 1, 24 fixed_frame = $('.av-frame-top').height(), 25 burger_menu = $('.av-burger-menu-main'), 26 calc_margin = function() 27 { 28 html_margin = parseInt( html.css('margin-top'), 10); 29 if(!$('.mobile_menu_toggle:visible').length) 30 { 31 $('.av-open-submenu').removeClass('av-open-submenu'); 32 } 33 34 menus.filter('.av-sticky-submenu').each(function() 35 { 36 $(this).next('.sticky_placeholder').height($(this).height()); 37 }); 38 39 }, 40 calc_values = function() 41 { 42 var content_width = setWitdth.width(); 43 html_margin = parseInt( html.css('margin-top'), 10); 44 menus.width(content_width); 45 }, 46 check = function(placeholder, no_timeout) 47 { 48 var menu_pos = this.offset().top, 49 top_pos = placeholder.offset().top, 50 scrolled = win.scrollTop(), 51 modifier = html_margin, 52 fixed = false; 53 54 /** 55 * If we have burger menu active we ignore sticking submenus 56 */ 57 if( burger_menu.is(":visible") ) 58 { 59 this.css({top: 'auto', position: 'absolute'}); fixed = false; 60 return; 61 } 62 63 if(header.length) 64 { 65 modifier += header.outerHeight() + parseInt( header.css('margin-top'), 10); 66 } 67 68 if(fixed_frame) 69 { 70 modifier += fixed_frame; 71 } 72 73 if(scrolled + modifier > top_pos) 74 { 75 if(!fixed) 76 { 77 this.css({top: modifier - bordermod, position: 'fixed'}); fixed = true; 78 } 79 } 80 else 81 { 82 this.css({top: 'auto', position: 'absolute'}); fixed = false; 83 } 84 85 }, 86 toggle = function(e) 87 { 88 e.preventDefault(); 89 90 var clicked = $(this), 91 menu = clicked.siblings('.av-subnav-menu'); 92 93 if(menu.hasClass('av-open-submenu')) 94 { 95 menu.removeClass('av-open-submenu'); 96 } 97 else 98 { 99 menu.addClass('av-open-submenu'); 100 } 101 }; 102 103 win.on("debouncedresize av-height-change", calc_margin ); calc_margin(); 104 105 if(setWitdth.length) 106 { 107 win.on("debouncedresize av-height-change", calc_values ); 108 calc_values(); 109 } 110 111 112 menus.each(function() 113 { 114 var menu = $(this), sticky = menu.filter('.av-sticky-submenu'), placeholder = menu.next('.sticky_placeholder'), mobile_button = menu.find('.mobile_menu_toggle'); 115 116 117 if(sticky.length) win.on( 'scroll debouncedresize', function(){ window.requestAnimationFrame( $.proxy( check, sticky, placeholder) ); } ); 118 119 if(mobile_button.length) 120 { 121 mobile_button.on( 'click', toggle ); 122 } 123 }); 124 125 126 html.on('click', '.av-submenu-hidden .av-open-submenu li a', function() 127 { 128 var current = $(this); 129 130 var list_item = current.siblings('ul, .avia_mega_div'); 131 if(list_item.length) 132 { 133 if(list_item.hasClass('av-visible-sublist')) 134 { 135 list_item.removeClass('av-visible-sublist'); 136 } 137 else 138 { 139 list_item.addClass('av-visible-sublist'); 140 } 141 return false; 142 } 143 }); 144 145 $('.avia_mobile').on('click', '.av-menu-mobile-disabled li a', function() 146 { 147 var current = $(this); 148 var list_item = current.siblings('ul'); 149 if(list_item.length) 150 { 151 if(list_item.hasClass('av-visible-mobile-sublist')) 152 { 153 154 } 155 else 156 { 157 $('.av-visible-mobile-sublist').removeClass('av-visible-mobile-sublist'); 158 list_item.addClass('av-visible-mobile-sublist'); 159 return false;
160 } 161 162 } 163 }); 164 165 166 167 }; 168 169 170}(jQuery));
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.