// let toggleBtn = function (firstEle, secondEle, classActive) { // firstEle.addEventListener("click", function () { // firstEle.classList.toggle(classActive); // secondEle.classList.toggle(classActive); // }); // secondEle.addEventListener("click", function () { // secondEle.classList.toggle(classActive); // firstEle.classList.toggle(classActive); // }); // }; //////////////////////// // main functions ///// ////////////////////// let toggleElement = function (ele, className) { ele.classList.toggle(className); }; let removeElemment = function (ele, className) { ele.classList.remove(className); }; let addElement = function (ele, className) { ele.classList.add(className); }; sal({ rootMargin: "0% 50%", threshold: 0.2, // 50% animateClassName: "sal-animate", disabledClassName: "sal-disabled", selector: "[data-sal]", once: false, // run only once disabled: false, enterEventName: "sal:in", exitEventName: "sal:out", }); ///////////////////////////////////// ///// start navbar ///////////////// /////////////////////////////////// // [01- dark and light ] // generate random number from 1 to 4 // let randomNum = Math.floor(Math.random() * 4) + 1; // let mobileImg = document.querySelector(".mobileImage img"); // mobileImg.setAttribute("src", `${ASSET_URL}/imgs/habashy${randomNum}.webp`); let addStyleToLocaleStorage = function () { if (localStorage.getItem("style") === null) { localStorage.setItem("style", "dark"); } else { localStorage.removeItem("style"); } }; let addDarkClassToHtml = function () { logo=document.querySelector('#logo'); firstphoto=document.querySelector('#firstphoto'); firstphone=document.querySelector('#firstphone'); gifi=document.querySelector('#gifi'); if (localStorage.getItem("style") === null) { document.documentElement.classList.remove("dark"); logo.src="https://mralaasabry.com/website/home/logomorning.png"; firstphoto.src="https://mralaasabry.com/website/home/alaam.png"; firstphone.src="https://mralaasabry.com/website/home/alaam.png"; gifi.src="https://mralaasabry.com/website/home/alaagifm.gif"; } else { document.documentElement.classList.add(localStorage.getItem("style")); logo.src="https://mralaasabry.com/website/home/logo.png"; firstphoto.src="https://mralaasabry.com/website/home/alaan.png"; firstphone.src="https://mralaasabry.com/website/home/alaan.png"; gifi.src="https://mralaasabry.com/website/home/alaagifn.gif"; } }; let updateUI = function () { addStyleToLocaleStorage(); addDarkClassToHtml(); // funChangeImagesDark(); }; // addDarkClassToHtml(); let sun = document.querySelector(".sunMoon"); // let moon = document.querySelector(".sunMoon"); sun.addEventListener("click", updateUI); // moon.addEventListener("click", updateUI); // [02 - toggle menu] let toggleBarBtn = document.querySelector(".toggleBarBtn"); let bigLeft = document.querySelector(".bigLeft"); toggleBarBtn.addEventListener("click", function () { toggleElement(bigLeft, "activeNavMenu"); }); //[04- testimonials} var swiper = new Swiper(".realSwiper", { slidesPerView: 3, spaceBetween: 30, speed: 600, navigation: { nextEl: ".swiper-button-next", prevEl: ".swiper-button-prev", }, autoplay: { delay: 5000, }, breakpoints: { // when window width is >= 320px // when window width is >= 480px 0: { slidesPerView: 1, spaceBetween: 30, }, // when window width is >= 640px 750: { slidesPerView: 2, spaceBetween: 30, }, 1400: { slidesPerView: 3, spaceBetween: 30, }, }, });