b374k
m1n1 1.01
Apache/2.4.41 (Ubuntu)
Linux vmi616275.contaboserver.net 5.4.0-84-generic #94-Ubuntu SMP Thu Aug 26 20:27:37 UTC 2021 x86_64
uid=33(www-data) gid=33(www-data) groups=33(www-data)
server ip : 62.171.164.128 | your ip : 127.0.0.1
safemode OFF
 >  / home / dev2.destoffenstraat.com / pub / home / fr / assets / js /
Filename/home/dev2.destoffenstraat.com/pub/home/fr/assets/js/jubyhyju2.js
Size2.04 kb
Permissionrw-r--r--
Ownerroot : root
Create time17-Aug-2025 10:26
Last modified29-Sep-2021 17:09
Last accessed23-Aug-2025 03:54
Actionsedit | rename | delete | download (gzip)
Viewtext | code | image
let dataBannerMain = document.querySelector("[data-banner]");
let dataCross = dataBannerMain.querySelector("[data-banner='close']");

let withBannerOffset = document.querySelector(".with-banner-offset");

let cookieBannerExist = Cookies.get("Banner");

function bannerShow() {
dataBannerMain.style.height = "auto";
dataCross.addEventListener("click", bannerHide);
}

function bannerHide() {
withBannerOffset.style.paddingTop = "0px";
dataBannerMain.style.height = "0px";
if (!cookieBannerExist) {
setBannerCookie();
}
}

function setBannerCookie() {
// Set cookie with expiration time (48 hours)
const expirationTime = 48 * 60 * 60 * 1000; // 48 hours in milliseconds
const expiryDate = new Date(Date.now() + expirationTime);
cookieBannerExist = Cookies.set("Banner", "Closed", { expires: expiryDate });
}

function CheckForBannerToShow() {
if (cookieBannerExist) {
bannerHide();
} else {
bannerShow();
console.log(cookieBannerExist);
}
}

CheckForBannerToShow(); // Invoke the function to check and show/hide banner initially

// ScrollTrigger configuration
gsap.registerPlugin(ScrollTrigger);

// Function to handle banner animation on scroll
function animateBannerOnScroll() {
gsap.to(dataBannerMain, {
scrollTrigger: {
trigger: dataBannerMain,
start: "top top", // Start animation when top of banner reaches top of viewport
end: "bottom top", // End animation when bottom of banner reaches top of viewport
scrub: true, // Smoothly animates the changes
},
marginTop: () => `-${dataBannerMain.clientHeight}px`, // Margin top decreases dynamically based on banner height
duration: 1,
ease: "ease-out", // Easing function for smooth animation
});
}

// Call this function to check banner status and animate on scroll
function setupBannerAnimation() {
if (!cookieBannerExist || cookieBannerExist !== "Closed") {
animateBannerOnScroll();
}
}

// Call this function to set up banner animation when the document is loaded
document.addEventListener("DOMContentLoaded", setupBannerAnimation);