1'use strict'; 2 3(function ($) { 4 'use strict'; 5 6 var holder_created = false; 7 var element_name = '.stm-header__row_color_' + stm_sticky; 8 var $element = $(element_name); 9 var elH = $element.outerHeight(); 10 var currentScrollPosition = 0; 11 var scrollDirection = 'bottom'; 12 var lastScroll = 0; 13 var elementTopPosition = 0; 14 var thresHold = 400; 15 var thresHoldMinus = 200; 16 var $holder = $('.pearl_sticky_holder'); 17 18 $(document).ready(function () { 19 if (typeof stm_sticky !== 'undefined') { 20 $element.addClass('pearl_is_sticky'); 21 create_holder($element, elH); 22 23 stm_sticky_header(); 24 } 25 }); 26 27 $(window).load(function () { 28 stm_sticky_header(); 29 }); 30 31 $(window).scroll(function () { 32 stm_sticky_header(); 33 }); 34 35 function stm_sticky_header() { 36 var windowW = window.innerWidth; 37 if ($element.length && windowW > 1024) { 38 elementTopPosition = $element.offset().top; 39 currentScrollPosition = $(document).scrollTop(); 40 if (currentScrollPosition > lastScroll) { 41 scrollingBottom(); 42 } else { 43 scrollingTop(); 44 } 45 lastScroll = currentScrollPosition; 46 } 47 48 if (windowW < 1025) { 49 $element.removeClass('pearl_is_sticky'); 50 } 51 } 52 53 function create_holder($element, elH) { 54 if (!holder_created) { 55 var holder = '<div class="pearl_sticky_holder hidden" style="height:' + elH + 'px"></div>'; 56 $element.before(holder); 57 holder_created = true; 58 } 59 } 60 61 function scrollingBottom() { 62 if (currentScrollPosition > thresHold - thresHoldMinus) { 63 $element.addClass('pearl_going_sticky'); 64 $('.pearl_sticky_holder').removeClass('hidden'); 65 } 66 67 if (currentScrollPosition > thresHold) { 68 $element.addClass('pearl_sticked'); 69 } 70 } 71 72 function scrollingTop() { 73 if (currentScrollPosition < thresHold) { 74 $element.removeClass('pearl_sticked pearl_going_sticky'); 75 $('.pearl_sticky_holder').addClass('hidden'); 76 } 77 } 78})(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.