KATEGORİLER

Fisher Price Sevimli Araçlar GJW12

{ if (slider.scrollLeft === 0) { navL.classList.add("disabled"); navL.classList.remove("enabled"); document.getElementById("left-blur").style.visibility = "hidden"; document.getElementById("left-blur").style.opacity = "0"; } else { navL.classList.add("enabled"); navL.classList.remove("disabled"); document.getElementById("left-blur").style.visibility = "visible"; document.getElementById("left-blur").style.opacity = "1"; } if (slider.scrollLeft >= wrapper.clientWidth - slider.clientWidth -10) { navR.classList.add("disabled"); navR.classList.remove("enabled"); document.getElementById("right-blur").style.visibility = "hidden"; document.getElementById("right-blur").style.opacity = "0"; } else { navR.classList.add("enabled"); navR.classList.remove("disabled"); document.getElementById("right-blur").style.visibility = "visible"; document.getElementById("right-blur").style.opacity = "1"; } }); if (navR) navR.addEventListener("click", (e) => { navL.classList.remove("disabled"); transition(slider, 0, slider.clientWidth, "right", () => { if (slider.scrollLeft >= wrapper.clientWidth - slider.clientWidth) { navR.classList.add("disabled"); } }); }); if (navL) navL.addEventListener("click", (e) => { navR.classList.remove("disabled"); transition(slider, 0, slider.clientWidth, "left", () => { if (slider.scrollLeft == 0) navL.classList.add("disabled"); }); }); } function transition(el, from, to, dir, cb) { let inc = from; let spd = 20; let interval = setInterval(() => { if (inc >= to) { clearInterval(interval); spd = to - inc; cb(); } el.scrollLeft = dir === "right" ? el.scrollLeft spd : el.scrollLeft - spd; inc = spd; }, 8); } function setWrapperWidth(sliderWrapper) { let slider = sliderWrapper.querySelector(".slider"); let wrapper = slider.querySelector(".wrapper"); let slides = wrapper.querySelectorAll(".slide"); wrapper.style.width = slides.length * slides[0].clientWidth "px"; } let slider = document.querySelector(".items"); let linkler = slider.querySelector(".wrapper"); let isDown = false; let startX; let scrollLeft; slider.addEventListener("mousedown", e => { isDown = true; slider.classList.add("active"); startX = e.pageX - slider.offsetLeft; scrollLeft = slider.scrollLeft; }); slider.addEventListener("mouseleave", () => { isDown = false; slider.classList.remove("active"); }); slider.addEventListener("mouseup", () => { isDown = false; slider.classList.remove("active"); linkler.classList.remove("disablelink"); }); slider.addEventListener("mousemove", e => { if (!isDown) return; e.preventDefault(); const x = e.pageX - slider.offsetLeft; const walk = x - startX; slider.scrollLeft = scrollLeft - walk; linkler.classList.add("disablelink"); });
{ if (slider.scrollLeft === 0) { navL.classList.add("disabled"); navL.classList.remove("enabled"); document.getElementById("left-blur").style.visibility = "hidden"; document.getElementById("left-blur").style.opacity = "0"; } else { navL.classList.add("enabled"); navL.classList.remove("disabled"); document.getElementById("left-blur").style.visibility = "visible"; document.getElementById("left-blur").style.opacity = "1"; } if (slider.scrollLeft >= wrapper.clientWidth - slider.clientWidth -10) { navR.classList.add("disabled"); navR.classList.remove("enabled"); document.getElementById("right-blur").style.visibility = "hidden"; document.getElementById("right-blur").style.opacity = "0"; } else { navR.classList.add("enabled"); navR.classList.remove("disabled"); document.getElementById("right-blur").style.visibility = "visible"; document.getElementById("right-blur").style.opacity = "1"; } }); if (navR) navR.addEventListener("click", (e) => { navL.classList.remove("disabled"); transition(slider, 0, slider.clientWidth, "right", () => { if (slider.scrollLeft >= wrapper.clientWidth - slider.clientWidth) { navR.classList.add("disabled"); } }); }); if (navL) navL.addEventListener("click", (e) => { navR.classList.remove("disabled"); transition(slider, 0, slider.clientWidth, "left", () => { if (slider.scrollLeft == 0) navL.classList.add("disabled"); }); }); } function transition(el, from, to, dir, cb) { let inc = from; let spd = 20; let interval = setInterval(() => { if (inc >= to) { clearInterval(interval); spd = to - inc; cb(); } el.scrollLeft = dir === "right" ? el.scrollLeft spd : el.scrollLeft - spd; inc = spd; }, 8); } function setWrapperWidth(sliderWrapper) { let slider = sliderWrapper.querySelector(".slider"); let wrapper = slider.querySelector(".wrapper"); let slides = wrapper.querySelectorAll(".slide"); wrapper.style.width = slides.length * slides[0].clientWidth "px"; } let slider = document.querySelector(".items"); let linkler = slider.querySelector(".wrapper"); let isDown = false; let startX; let scrollLeft; slider.addEventListener("mousedown", e => { isDown = true; slider.classList.add("active"); startX = e.pageX - slider.offsetLeft; scrollLeft = slider.scrollLeft; }); slider.addEventListener("mouseleave", () => { isDown = false; slider.classList.remove("active"); }); slider.addEventListener("mouseup", () => { isDown = false; slider.classList.remove("active"); linkler.classList.remove("disablelink"); }); slider.addEventListener("mousemove", e => { if (!isDown) return; e.preventDefault(); const x = e.pageX - slider.offsetLeft; const walk = x - startX; slider.scrollLeft = scrollLeft - walk; linkler.classList.add("disablelink"); });