1var mobileFooterBanner = (function () { 2 var $isInViewportHelper; 3 var $mobileBanner; 4 5 function init() { 6 $isInViewportHelper = $("main"); 7 if (!$isInViewportHelper.length) { 8 return; 9 } 10 $mobileBanner = $(".mobile-footerbanner"); 11 setupHelper(); 12 $(window).scroll(revealer); 13 $(window).resize(setupHelper); 14 } 15 16 function setupHelper() { 17 var helperTop = 0; 18 var helperHeight = 0; 19 20 if ($(".main").hasClass("home")) { 21 helperTop = $(".sw19b-hero").height(); 22 helperHeight = $(".col-8-width .button").offset().top; 23 } else if ($(".cta-section .button").length) { 24 helperHeight = $(".cta-section .button").offset().top; 25 } 26 27 if (helperHeight) { 28 TweenMax.set($isInViewportHelper, { 29 top: helperTop, 30 //height: 150 + helperHeight - helperTop - window.innerHeight, 31 }); 32 } 33 } 34 35 function revealer() { 36 if ($isInViewportHelper.is(":in-viewport(50)")) { 37 $mobileBanner.addClass("show-me"); 38 } else { 39 $mobileBanner.removeClass("show-me"); 40 } 41 } 42 43 return { 44 init: init, 45 }; 46})(); 47 48function mobile_footerbanner_init() { 49 function is_below_viewport(elem) { 50 return elem.getBoundingClientRect().top > window.innerHeight; 51 } 52 53 var cta = document.querySelector(".footerbanner-show-cta"); 54 var banner = document.querySelector(".mobile-footerbanner"); 55 if (!cta || !banner) { 56 return; 57 } 58 59 window.addEventListener("scroll", function (e) { 60 if (is_below_viewport(cta)) { 61 banner.classList.add("show-me"); 62 } else { 63 banner.classList.remove("show-me"); 64 } 65 }); 66} 67 68mobile_footerbanner_init();
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.