1 line
No EOL
2.2 KiB
JavaScript
1 line
No EOL
2.2 KiB
JavaScript
(()=>{var e;AstraPageTitle={init:function(){AstraPageTitle._initBackgrounds(),AstraPageTitle._initFullScreenHeight()},_initBackgrounds:function(){0<document.querySelectorAll(".ast-advanced-headers-parallax").length&&(AstraPageTitle._scrollParallaxBackground(),window.addEventListener("scroll",function(){AstraPageTitle._scrollParallaxBackgrounds()}),window.addEventListener("resize",function(){AstraPageTitle._scrollParallaxBackgrounds()}))},_scrollParallaxBackgrounds:function(){document.querySelectorAll(".ast-advanced-headers-parallax").forEach(e=>{AstraPageTitle._scrollParallaxBackground()})},_scrollParallaxBackground:function(){var e=document.querySelector(".ast-advanced-headers-parallax"),t=e.getBoundingClientRect();const a=t.top+window.scrollY;var t=e.getAttribute("data-parallax-speed"),n=e.getAttribute("data-parallax-device"),t=-(window.scrollY-a)/t;"both"===n?e.style.backgroundPosition="center "+t+"px":"desktop"===n?document.body.classList.contains("ast-desktop")?e.style.backgroundPosition="center "+t+"px":e.style.backgroundPosition="":document.body.classList.contains("ast-header-break-point")?e.style.backgroundPosition="center "+t+"px":e.style.backgroundPosition=""},_initFullScreenHeight:function(){let t;if(document.querySelectorAll(".ast-full-advanced-header")&&document.querySelectorAll(".ast-full-advanced-header")[0]){AstraPageTitle._astraPageFullHeader();let e=window.innerWidth;window.addEventListener("resize",function(){window.innerWidth!=e&&(clearTimeout(t),t=setTimeout(function(){AstraPageTitle._astraPageFullHeader()},200),e=window.innerWidth)}),window.addEventListener("orientationchange",function(){window.innerWidth!=e&&(clearTimeout(t),t=setTimeout(function(){AstraPageTitle._astraPageFullHeader()},200),e=window.innerWidth)})}},_astraPageFullHeader:function(){var e,t;document.querySelectorAll(".ast-full-advanced-header").length&&(e=window.innerHeight,t=document.querySelector(".ast-full-advanced-header").getBoundingClientRect().top+window.scrollY,document.querySelector(".ast-full-advanced-header").style.height=e-t+"px")}},e=function(){AstraPageTitle.init()},"interactive"===document.readyState||"complete"===document.readyState?e():document.addEventListener("DOMContentLoaded",e)})(); |