PageSourceSearch

https://ncbeonline.com/wp-content/themes/enfold/js/avia-snippet-sticky-header.js?ver=4.4.1

js ncbeonline.com collected 2026-09-24 12:07:32 UTC 4,249 bytes, 139 lines download raw bytes

1(function($)
2{	
3    "use strict";
4    
5    $(document).ready(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) return;
46        
47        var logo            = $('#header_main .container .logo img, #header_main .container .logo a'),
48            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'),
49            el_height       = $(elements).filter(':first').height(),
50            isMobile        = $.avia_utilities.isMobile,
51            scroll_top		= $('#scroll-top-link'),
52            transparent 	= header.is('.av_header_transparency'),
53            shrinking		= header.is('.av_header_shrinking'),
54            topbar_height	= header.find('#header_meta').outerHeight(),
55            set_height      = function()
56            {	
57                var st = win.scrollTop(), newH = 0, st_real = st;
58				
59				if(unsticktop) st -= topbar_height; 
60				if(st < 0) st = 0;
61				
62				if(shrinking && !isMobile)
63                {
64	                if(st < el_height/2)
65	                {
66	                    newH = el_height - st;
67	                    if(st <= 0){
68							newH = el_height;
69					    }
70	                    
71	                    av_change_class(header, 'remove', 'header-scrolled');
72	                    //header.removeClass('header-scrolled');
73	                }
74	                else
75	                {
76	                    newH = el_height/2;
77	                    //header.addClass('header-scrolled');
78	                    av_change_class(header, 'add', 'header-scrolled');
79	                }
80	                
81	                if(st - 30 < el_height)
82	                {
83	                    av_change_class(header, 'remove', 'header-scrolled-full');
84	                }
85	                else
86	                {
87	                    av_change_class(header, 'add', 'header-scrolled-full');
88	                }
89	                
90	                
91	                elements.css({'height': newH + 'px', 'lineHeight': newH + 'px'});
92                	logo.css({'maxHeight': newH + 'px'});
93                }
94                
95                if(unsticktop.length)
96            	{
97                	if( st <= 0)
98                	{
99	                	if(st_real <= 0) st_real = 0;
100                		unsticktop.css({"margin-top":"-"+st_real+"px"});
101					}
102					else
103					{
104                		unsticktop.css({"margin-top":"-"+topbar_height+"px"});
105					}
106            	}
107                
108                if(transparent)
109                {	
110                	if(st > 50)
111                	{	
112                		//header.removeClass('av_header_transparency');
113                		av_change_class(header, 'remove', 'av_header_transparency');
114                	}
115                	else
116                	{
117                		//header.addClass('av_header_transparency');
118                		av_change_class(header, 'add', 'av_header_transparency');
119                	}
120                }
121
122               
123            };
124
125            if($('body').is('.avia_deactivate_menu_resize')) shrinking = false;
126            
127            if(!transparent && !shrinking && !unsticktop.length) return;
128            
129			win.on( 'debouncedresize',  function(){ el_height = $(elements).attr('style',"").filter(':first').height(); set_height(); } );
130            win.on( 'scroll',  function(){ window.requestAnimationFrame( set_height )} );
131            set_height();
132    }
133
134
135})(jQuery);
136
137
138
139

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.