/* Add custom Js styles below */
document.addEventListener("DOMContentLoaded", function() {
const images = document.querySelectorAll("img");
images.forEach(img => {
img.setAttribute("loading", "lazy");
});
});
window.addEventListener("load", function() {
const sections = document.querySelectorAll(".section");
sections.forEach(sec => {
sec.style.contentVisibility = "auto";
});
});
/******/
/* Add custom Js styles below */
document.addEventListener("DOMContentLoaded", function () {
const sliders = document.querySelectorAll(".s-block--photos-slider");
if (sliders.length < 2) return; // نتأكد إن فيه عنصر تاني
const secondSlider = sliders[1]; // ده التاني
const topBar = document.createElement("div");
topBar.className = "top-moving-bar";
secondSlider.parentNode.insertBefore(topBar, secondSlider);
});
/********************js*************/
const statsSection = document.createElement("section");
statsSection.className = "stats-section";
statsSection.setAttribute("aria-label", "عنوان قسم الخصائص");
statsSection.innerHTML = `
لماذا تختارنا؟
`;
// نحط العنوان داخل البلوك الرئيسي
const container = document.querySelector(".s-block.s-block--features.container");
if (container) {
container.insertBefore(statsSection, container.firstChild); // يضيفه أول عنصر داخل البلوك
}
function handleScroll() {
const statsHeading = document.querySelector('.stats-section h2');
const rect = statsHeading.getBoundingClientRect();
if (rect.top < window.innerHeight - 100) {
statsHeading.classList.add('in-view');
window.removeEventListener('scroll', handleScroll);
}
}
window.addEventListener('scroll', handleScroll);
window.addEventListener('load', handleScroll);
function handleScroll() {
const statsHeading = document.querySelector('.stats-section h2');
const rect = statsHeading.getBoundingClientRect();
if (rect.top < window.innerHeight - 100) {
statsHeading.classList.add('in-view');
window.removeEventListener('scroll', handleScroll);
}
}
window.addEventListener('scroll', handleScroll);
window.addEventListener('load', handleScroll);
/********** لوجو ************/
document.addEventListener("DOMContentLoaded", function () {
const footerInner = document.querySelector(".store-footer__inner");
if (footerInner) {
const logo = document.createElement("img");
logo.src = "https://cdn.salla.sa/cdn-cgi/image/fit=scale-down,width=400,height=400,onerror=redirect,format=auto/zvmrxO/stores/logos/8v909GCUEnAfQhX4xtFYUOxN6ieDXArcX8luYtLY.png";
logo.alt = "Logo";
logo.className = "footer-logo";
footerInner.prepend(logo);
}
});