var footer = ` `; document.querySelectorAll(".footer-menu__item")[1].insertAdjacentHTML("afterend", footer); //footer content customee //icon footer button document.getElementById("footer-popup").addEventListener("click",function(){ const img = document.querySelector('#menufooter-icon'); const content = document.querySelector('#menufooter-icon_content'); console.log(content); if(!content.classList.contains('hide')){ // content.animate({bottom: '0',opacity: '0'}, "slow"); animateElement(content, 0, 0) setTimeout(() => { img.setAttribute('src', `https://landingsplash.xyz/banner/image/promotion/Slotasiabet.png`); content.classList.add("hide"); },800); }else{ // content.animate({bottom: '50px',opacity: '1'}, "slow"); animateElement(content, 50, 1) content.classList.remove("hide"); img.setAttribute('src', `https://landingsplash.xyz/banner/image/promotion/X Mark Black.png`); } toggleClass(img, 'rotate-360') setTimeout(() => { img.classList.remove("rotate-360"); },1000); }); function animateElement(content, bottomValue, opacityValue) { bottomValue -= 1; opacityValue -= 0.01; content.style.bottom = bottomValue + 'px'; content.style.opacity = opacityValue; if (bottomValue <= 0 || opacityValue <= 0) { clearInterval(20); } } function toggleClass(element, className) { if (element.classList.contains(className)) { element.classList.remove(className); } else { element.classList.add(className); } }