1(function($) 2{ 3 "use strict"; 4 5 $( function() 6 { 7 // decreases header size when user scrolls down 8 avia_header_size(); 9 }); 10 11 12 function av_change_class($element, change_method, class_name) 13 { 14 if($element[0].classList) 15 { 16 if(change_method == "add") 17 { 18 $element[0].classList.add(class_name); 19 } 20 else 21 { 22 $element[0].classList.remove(class_name); 23 } 24 } 25 else 26 { 27 if(change_method == "add") 28 { 29 $element.addClass(class_name); 30 } 31 else 32 { 33 $element.removeClass(class_name); 34 } 35 } 36 } 37 38 39 function avia_header_size() 40 { 41 var win = $(window), 42 header = $('.html_header_top.html_header_sticky #header'), 43 unsticktop = $('.av_header_unstick_top'); 44 45 if( ! header.length && ! unsticktop.length ) 46 { 47 return; 48 } 49 50 var logo = $('#header_main .container .logo img, #header_main .container .logo svg, #header_main .container .logo a'), 51 elements = $('#header_main .container:not(#header_main_alternate>.container), #header_main .main_menu ul:first-child > li > a:not(.avia_mega_div a, #header_main_alternate a), #header_main #menu-item-shop .cart_dropdown_link'), 52 el_height = $(elements).first().height(), 53 isMobile = $.avia_utilities.isMobile, 54 scroll_top = $('#scroll-top-link'), 55 transparent = header.is('.av_header_transparency'), 56 shrinking = header.is('.av_header_shrinking'), 57 shrink_factor = header.data( 'av_shrink_factor' ), 58 shrink_val = el_height/2.0, 59 el_shrinked = el_height/2.0, 60 header_meta = header.find('#header_meta'), 61 topbar_height = header_meta.length ? header_meta.outerHeight() : 0, 62 63 set_height = function() 64 { 65 var st = win.scrollTop(), 66 newH = 0, 67 st_real = st; 68 69 if( unsticktop ) 70 { 71 st -= topbar_height; 72 } 73 74 if( st < 0 ) 75 { 76 st = 0; 77 } 78 79 if( shrinking && ! isMobile ) 80 { 81 if( st < shrink_val ) 82 { 83 newH = el_height - st; 84 if( st <= 0 ) 85 { 86 newH = el_height; 87 } 88 89 av_change_class( header, 'remove', 'header-scrolled' ); 90 //header.removeClass('header-scrolled'); 91 } 92 else 93 { 94 newH = el_shrinked; 95 //header.addClass('header-scrolled'); 96 av_change_class( header, 'add', 'header-scrolled' ); 97 } 98 99 if( st - 30 < el_height ) 100 { 101 av_change_class( header, 'remove', 'header-scrolled-full' ); 102 } 103 else 104 { 105 av_change_class( header, 'add', 'header-scrolled-full' ); 106 } 107 108 elements.css({'height': newH + 'px', 'lineHeight': newH + 'px'}); 109 logo.css({'maxHeight': newH + 'px'}); 110 } 111 112 if( unsticktop.length ) 113 { 114 if( st <= 0 ) 115 { 116 if( st_real <= 0 ) 117 { 118 st_real = 0; 119 } 120 121 unsticktop.css({"margin-top":"-"+st_real+"px"}); 122 } 123 else 124 { 125 unsticktop.css({"margin-top":"-"+topbar_height+"px"}); 126 } 127 } 128 129 if( transparent ) 130 { 131 if( st > 50 ) 132 { 133 //header.removeClass('av_header_transparency'); 134 av_change_class( header, 'remove', 'av_header_transparency' ); 135 } 136 else 137 { 138 //header.addClass('av_header_transparency'); 139 av_change_class( header, 'add', 'av_header_transparency' ); 140 } 141 } 142 }; 143 144 if( typeof shrink_factor != 'undefined' ) 145 { 146 const value = parseInt( shrink_factor ); 147 if( ! isNaN( value ) ) 148 { 149 shrink_val = el_height * ( value / 100.0 ); 150 el_shrinked = el_height - shrink_val; 151 } 152 } 153 154 if( $('body').is( '.avia_deactivate_menu_resize' ) ) 155 { 156 shrinking = false; 157 } 158 159 if( ! transparent && ! shrinking && ! unsticktop.length ) 160 { 161 return; 162 } 163 164 win.on( 'debouncedresize', function() 165 { 166 el_height = $( elements ).attr( 'style',"" ).first().height(); 167 set_height(); 168 }); 169 170 win.on( 'scroll', function() 171 { 172 window.requestAnimationFrame( set_height ); 173 }); 174 175 set_height(); 176 } 177 178})(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.