الگو:اسلایدر/دماوندپلیمر: تفاوت میان نسخهها
بدون خلاصۀ ویرایش |
بدون خلاصۀ ویرایش برچسب: برگرداندهشده |
||
| خط ۱: | خط ۱: | ||
<html> | <html> | ||
< | <style> | ||
.fgwiki-gallery { | |||
--fg-items: 3; | |||
--fg-gap: 18px; | |||
--fg-radius: 18px; | |||
--fg-image-height: 300px; | |||
--fg-side-blur: 2px; | |||
--fg-side-opacity: 0.55; | |||
/* ===== Damavand Polymer Theme ===== */ | |||
--fg-accent: #0B5FB3; | |||
--fg-accent-dark: #084C91; | |||
--fg-accent-light: #EAF4FC; | |||
--fg-success: #2E9E44; | |||
--fg-success-dark: #237A35; | |||
--fg-success-light: #EDF8EF; | |||
--fg-card-bg: #FFFFFF; | |||
--fg-image-bg: #F6FBFD; | |||
--fg-caption-bg: #FFFFFF; | |||
--fg-caption-color: #17406B; | |||
position: relative; | |||
width: min(100%, 1240px); | |||
margin: 28px auto; | |||
padding: 0 56px 42px; | |||
direction: rtl; | |||
font-family: iransans, Arial, sans-serif; | |||
} | |||
.fgwiki-gallery__slide { | |||
flex: 0 0 calc( | |||
(100% - (var(--fg-items) - 1) * var(--fg-gap)) / var(--fg-items) | |||
); | |||
min-width: 0; | |||
margin: 0; | |||
overflow: hidden; | |||
background: var(--fg-card-bg); | |||
border: 1px solid rgba(11, 95, 179, 0.10); | |||
border-radius: var(--fg-radius); | |||
box-shadow: 0 10px 28px rgba(11, 95, 179, 0.10); | |||
transition: | |||
transform 450ms ease, | |||
filter 450ms ease, | |||
opacity 450ms ease, | |||
box-shadow 450ms ease, | |||
border-color 450ms ease; | |||
} | |||
.fgwiki-gallery__slide img { | |||
display: block; | |||
width: 100%; | |||
height: var(--fg-image-height); | |||
padding: 10px; | |||
background: linear-gradient(180deg, #FFFFFF 0%, #F6FBFD 100%); | |||
object-fit: contain; | |||
object-position: center; | |||
border: 0; | |||
} | |||
.fgwiki-gallery__caption { | |||
min-height: 72px; | |||
padding: 14px 16px 16px; | |||
color: var(--fg-caption-color); | |||
background: var(--fg-caption-bg); | |||
border-top: 3px solid var(--fg-success); | |||
font-size: 14px; | |||
font-weight: 700; | |||
line-height: 1.9; | |||
text-align: right; | |||
} | |||
.fgwiki-gallery__slide.is-center { | |||
filter: none; | |||
opacity: 1; | |||
transform: scale(1.03); | |||
border-color: rgba(46, 158, 68, 0.35); | |||
box-shadow: | |||
0 18px 42px rgba(11, 95, 179, 0.18), | |||
0 0 0 2px rgba(46, 158, 68, 0.10); | |||
} | |||
.fgwiki-gallery__button { | |||
position: absolute; | |||
top: calc(50% - 24px); | |||
z-index: 15; | |||
display: flex; | |||
align-items: center; | |||
justify-content: center; | |||
width: 44px; | |||
height: 44px; | |||
padding: 0; | |||
color: #ffffff; | |||
background: linear-gradient(135deg, #0B5FB3 0%, #2E9E44 100%); | |||
border: 0; | |||
border-radius: 50%; | |||
box-shadow: 0 8px 22px rgba(11, 95, 179, 0.25); | |||
font-family: Arial, sans-serif; | |||
font-size: 24px; | |||
line-height: 1; | |||
cursor: pointer; | |||
transform: translateY(-50%); | |||
transition: | |||
background 220ms ease, | |||
transform 220ms ease, | |||
box-shadow 220ms ease; | |||
} | |||
.fgwiki-gallery__button:hover { | |||
background: linear-gradient(135deg, #084C91 0%, #237A35 100%); | |||
transform: translateY(-50%) scale(1.08); | |||
box-shadow: 0 12px 28px rgba(11, 95, 179, 0.35); | |||
} | |||
.fgwiki-gallery__button:focus-visible { | |||
outline: 3px solid rgba(11, 95, 179, 0.25); | |||
outline-offset: 3px; | |||
} | |||
.fgwiki-gallery__button--right { | |||
right: 0; | |||
} | |||
.fgwiki-gallery__button--left { | |||
left: 0; | |||
} | |||
.fgwiki-gallery__dots { | |||
position: absolute; | |||
right: 50%; | |||
bottom: 6px; | |||
display: flex; | |||
align-items: center; | |||
justify-content: center; | |||
gap: 8px; | |||
transform: translateX(50%); | |||
} | |||
.fgwiki-gallery__dot { | |||
width: 9px; | |||
height: 9px; | |||
padding: 0; | |||
background: #B8C8D6; | |||
border: 0; | |||
border-radius: 50%; | |||
cursor: pointer; | |||
transition: | |||
width 250ms ease, | |||
background-color 250ms ease, | |||
opacity 250ms ease; | |||
} | |||
.fgwiki-gallery__dot.is-active { | |||
width: 24px; | |||
background: linear-gradient(90deg, #0B5FB3 0%, #2E9E44 100%); | |||
border-radius: 999px; | |||
} | |||
.fgwiki-gallery__dot:focus-visible { | |||
outline: 2px solid #0B5FB3; | |||
outline-offset: 2px; | |||
} | |||
@media (max-width: 900px) { | |||
.fgwiki-gallery { | |||
--fg-items: 2; | |||
--fg-image-height: 280px; | |||
--fg-side-blur: 1.5px; | |||
padding-right: 46px; | |||
padding-left: 46px; | |||
} | } | ||
.fgwiki-gallery__slide { | .fgwiki-gallery__slide { | ||
border-color: rgba(11, 95, 179, 0.10); | |||
box-shadow: 0 8px 22px rgba(11, 95, 179, 0.10); | |||
border- | |||
box-shadow: 0 | |||
} | } | ||
.fgwiki-gallery__slide | .fgwiki-gallery__slide.is-center { | ||
border-color: rgba(46, 158, 68, 0.35); | |||
box-shadow: | |||
0 14px 34px rgba(11, 95, 179, 0.18), | |||
0 0 0 2px rgba(46, 158, 68, 0.10); | |||
} | } | ||
.fgwiki-gallery__caption { | .fgwiki-gallery__caption { | ||
min-height: | min-height: 68px; | ||
font-size: 13px; | |||
color: #17406B; | |||
border-top: 3px solid #2E9E44; | |||
font-size: | |||
} | } | ||
.fgwiki- | .fgwiki-gallery__button { | ||
width: 40px; | |||
height: 40px; | |||
font-size: 21px; | |||
background: linear-gradient(135deg, #0B5FB3 0%, #2E9E44 100%); | |||
} | |||
.fgwiki-gallery__button:hover { | |||
background: linear-gradient(135deg, #084C91 0%, #237A35 100%); | |||
} | } | ||
.fgwiki- | .fgwiki-gallery__dot.is-active { | ||
background: linear-gradient(90deg, #0B5FB3 0%, #2E9E44 100%); | |||
} | } | ||
} | |||
.fgwiki- | @media (max-width: 600px) { | ||
.fgwiki-gallery { | |||
--fg-items: 1; | |||
--fg-gap: 12px; | |||
--fg-image-height: 260px; | |||
--fg-side-blur: 0; | |||
--fg-side-opacity: 1; | |||
width: 100%; | |||
height: | padding-right: 36px; | ||
padding-left: 36px; | |||
} | } | ||
.fgwiki- | .fgwiki-gallery__slide, | ||
.fgwiki-gallery__slide.is-center, | |||
transform: | .fgwiki-gallery__slide:not(.is-center) { | ||
filter: none; | |||
opacity: 1; | |||
transform: none; | |||
} | } | ||
.fgwiki- | .fgwiki-gallery__slide { | ||
border-color: rgba(11, 95, 179, 0.10); | |||
box-shadow: 0 8px 20px rgba(11, 95, 179, 0.10); | |||
} | } | ||
.fgwiki- | .fgwiki-gallery__caption { | ||
min-height: 62px; | |||
padding: 12px 14px; | |||
font-size: 13px; | |||
line-height: 1.8; | |||
color: #17406B; | |||
border-top: 3px solid #2E9E44; | |||
} | } | ||
.fgwiki-gallery__button- | .fgwiki-gallery__button { | ||
width: 34px; | |||
height: 34px; | |||
font-size: 18px; | |||
background: linear-gradient(135deg, #0B5FB3 0%, #2E9E44 100%); | |||
} | } | ||
.fgwiki- | .fgwiki-gallery__dot.is-active { | ||
background: linear-gradient(90deg, #0B5FB3 0%, #2E9E44 100%); | |||
} | } | ||
} | |||
@media (prefers-reduced-motion: reduce) { | |||
.fgwiki-gallery__track, | |||
.fgwiki-gallery__slide, | |||
.fgwiki-gallery__button, | |||
.fgwiki-gallery__dot { | .fgwiki-gallery__dot { | ||
transition: none; | |||
transition: | |||
} | } | ||
} | |||
</style> | |||
<script> | |||
(function () { | |||
"use strict"; | |||
.fgwiki- | document.querySelectorAll(".fgwiki-gallery").forEach(function (slider) { | ||
const track = slider.querySelector(".fgwiki-gallery__track"); | |||
const originalSlides = Array.from( | |||
slider.querySelectorAll(".fgwiki-gallery__slide") | |||
); | |||
const rightButton = slider.querySelector(".fgwiki-gallery__button--right"); | |||
const leftButton = slider.querySelector(".fgwiki-gallery__button--left"); | |||
const dotsContainer = slider.querySelector(".fgwiki-gallery__dots"); | |||
if (!track || originalSlides.length === 0) { | |||
return; | |||
} | } | ||
let currentIndex = 0; | |||
let autoPlayTimer = null; | |||
let touchStartX = 0; | |||
let touchEndX = 0; | |||
let isAnimating = false; | |||
const autoPlayDelay = 3500; | |||
function getVisibleItems() { | |||
const value = getComputedStyle(slider) | |||
.getPropertyValue("--fg-items") | |||
.trim(); | |||
return Math.max(1, parseInt(value, 10) || 1); | |||
} | } | ||
. | function cleanupClones() { | ||
Array.from(track.querySelectorAll(".is-clone")).forEach(function (node) { | |||
node.remove(); | |||
}); | |||
} | } | ||
function buildInfiniteTrack() { | |||
cleanupClones(); | |||
-- | const visibleItems = getVisibleItems(); | ||
const slides = Array.from(track.children).filter(function (slide) { | |||
-- | return !slide.classList.contains("is-clone"); | ||
}); | |||
const prependClones = slides.slice(-visibleItems).map(function (slide) { | |||
const clone = slide.cloneNode(true); | |||
clone.classList.add("is-clone"); | |||
clone.setAttribute("aria-hidden", "true"); | |||
return clone; | |||
}); | |||
const appendClones = slides.slice(0, visibleItems).map(function (slide) { | |||
const clone = slide.cloneNode(true); | |||
clone.classList.add("is-clone"); | |||
clone.setAttribute("aria-hidden", "true"); | |||
return clone; | |||
}); | |||
prependClones.forEach(function (clone) { | |||
track.insertBefore(clone, track.firstChild); | |||
}); | |||
appendClones.forEach(function (clone) { | |||
track.appendChild(clone); | |||
}); | |||
currentIndex = visibleItems; | |||
updateSlider(false); | |||
} | } | ||
function getAllSlides() { | |||
return Array.from(track.querySelectorAll(".fgwiki-gallery__slide")); | |||
} | } | ||
function getRealSlidesCount() { | |||
return originalSlides.length; | |||
} | } | ||
function getSlideStep() { | |||
const slides = getAllSlides(); | |||
< | if (slides.length < 2) { | ||
return slides[0] ? slides[0].getBoundingClientRect().width : 0; | |||
} | |||
const firstSlide = slides[0].getBoundingClientRect(); | |||
const secondSlide = slides[1].getBoundingClientRect(); | |||
const | |||
const | |||
return Math.abs(secondSlide.left - firstSlide.left); | |||
} | |||
function updateDots() { | |||
const visibleItems = getVisibleItems(); | |||
const realSlidesCount = getRealSlidesCount(); | |||
const maxDotIndex = Math.max(0, realSlidesCount - visibleItems); | |||
const realIndex = | |||
const | ((currentIndex - visibleItems) % realSlidesCount + realSlidesCount) % | ||
realSlidesCount; | |||
const activeDotIndex = Math.min(realIndex, maxDotIndex); | |||
const dots = dotsContainer.querySelectorAll(".fgwiki-gallery__dot"); | |||
dots.forEach(function (dot, index) { | |||
const isActive = index === activeDotIndex; | |||
dot.classList.toggle("is-active", isActive); | |||
dot.setAttribute("aria-current", isActive ? "true" : "false"); | |||
}); | |||
} | |||
function updateCenterState() { | |||
const visibleItems = getVisibleItems(); | |||
const centerOffset = Math.floor(visibleItems / 2); | |||
const centerIndex = currentIndex + centerOffset; | |||
const slides = getAllSlides(); | |||
function | slides.forEach(function (slide, index) { | ||
slide.classList.toggle("is-center", index === centerIndex); | |||
}); | |||
} | |||
})(); | |||
function updateSlider(animate) { | |||
const step = getSlideStep(); | |||
const offset = currentIndex * step; | |||
if (!animate) { | |||
track.style.transition = "none"; | |||
} else { | |||
track.style.transition = ""; | |||
} | |||
track.style.transform = | |||
"translate3d(" + offset + "px, 0, 0)"; | |||
updateDots(); | |||
updateCenterState(); | |||
if (!animate) { | |||
track. | requestAnimationFrame(function () { | ||
requestAnimationFrame(function () { | |||
track.style.transition = ""; | |||
}); | |||
}); | }); | ||
} | |||
} | |||
function jumpIfNeeded() { | |||
const visibleItems = getVisibleItems(); | |||
const realSlidesCount = getRealSlidesCount(); | |||
if (currentIndex >= realSlidesCount + visibleItems) { | |||
currentIndex = visibleItems; | currentIndex = visibleItems; | ||
updateSlider(false); | |||
} else if (currentIndex < visibleItems) { | |||
currentIndex = realSlidesCount + visibleItems - 1; | |||
updateSlider(false); | updateSlider(false); | ||
} | } | ||
updateCenterState(); | |||
updateDots(); | |||
} | |||
function goToSlide(index) { | |||
return | if (isAnimating) { | ||
return; | |||
} | } | ||
isAnimating = true; | |||
currentIndex = index; | |||
updateSlider(true); | |||
window.setTimeout(function () { | |||
jumpIfNeeded(); | |||
} | isAnimating = false; | ||
}, 680); | |||
} | |||
function moveRight() { | |||
goToSlide(currentIndex + 1); | |||
} | |||
function moveLeft() { | |||
goToSlide(currentIndex - 1); | |||
} | |||
function createDots() { | |||
const visibleItems = getVisibleItems(); | |||
const dotsCount = Math.max( | |||
1, | |||
getRealSlidesCount() - visibleItems + 1 | |||
); | |||
dotsContainer.innerHTML = ""; | |||
for (let index = 0; index < dotsCount; index += 1) { | |||
const dot = document.createElement("button"); | |||
dot.type = "button"; | |||
dot.className = "fgwiki-gallery__dot"; | |||
dot.setAttribute( | |||
"aria-label", | |||
"نمایش اسلاید شماره " + (index + 1) | |||
); | |||
dot.addEventListener("click", function () { | |||
currentIndex = getVisibleItems() + index; | |||
updateSlider(true); | |||
restartAutoPlay(); | |||
}); | }); | ||
dotsContainer.appendChild(dot); | |||
} | } | ||
updateDots(); | |||
} | |||
function startAutoPlay() { | |||
stopAutoPlay(); | |||
if ( | |||
window.matchMedia( | |||
"(prefers-reduced-motion: reduce)" | |||
).matches | |||
) { | |||
return; | |||
} | } | ||
function | autoPlayTimer = window.setInterval(function () { | ||
moveRight(); | |||
}, autoPlayDelay); | |||
} | |||
function stopAutoPlay() { | |||
if (autoPlayTimer !== null) { | |||
window.clearInterval(autoPlayTimer); | |||
autoPlayTimer = null; | |||
} | } | ||
} | |||
function | function restartAutoPlay() { | ||
stopAutoPlay(); | |||
startAutoPlay(); | |||
} | |||
rightButton.addEventListener("click", function () { | |||
moveRight(); | |||
restartAutoPlay(); | |||
}); | |||
leftButton.addEventListener("click", function () { | |||
moveLeft(); | |||
restartAutoPlay(); | |||
}); | |||
slider.addEventListener("mouseenter", stopAutoPlay); | |||
slider.addEventListener("mouseleave", startAutoPlay); | |||
slider.addEventListener("focusin", stopAutoPlay); | |||
slider.addEventListener("focusout", function (event) { | |||
if (!slider.contains(event.relatedTarget)) { | |||
startAutoPlay(); | |||
} | } | ||
}); | |||
function | slider.addEventListener( | ||
"touchstart", | |||
} | function (event) { | ||
touchStartX = event.changedTouches[0].clientX; | |||
touchEndX = touchStartX; | |||
stopAutoPlay(); | |||
}, | |||
{ passive: true } | |||
); | |||
function | slider.addEventListener( | ||
"touchmove", | |||
function (event) { | |||
touchEndX = event.changedTouches[0].clientX; | |||
}, | |||
{ passive: true } | |||
); | |||
slider.addEventListener( | |||
"touchend", | |||
function () { | |||
const swipeDistance = touchEndX - touchStartX; | |||
if (Math.abs(swipeDistance) > 45) { | |||
if (swipeDistance > 0) { | |||
moveRight(); | |||
} else { | |||
moveLeft(); | |||
} | |||
} | |||
} | } | ||
startAutoPlay(); | |||
} | }, | ||
{ passive: true } | |||
); | |||
window.addEventListener("resize", function () { | |||
buildInfiniteTrack(); | |||
createDots(); | |||
}); | |||
if ("IntersectionObserver" in window) { | |||
const observer = new IntersectionObserver( | |||
function (entries) { | |||
entries.forEach(function (entry) { | |||
if (entry.isIntersecting) { | |||
startAutoPlay(); | |||
} else { | |||
stopAutoPlay(); | |||
} | |||
}); | |||
}, | |||
{ | |||
threshold: 0.2 | |||
} | } | ||
); | |||
observer.observe(slider); | |||
} else { | |||
startAutoPlay(); | |||
} | |||
buildInfiniteTrack(); | |||
createDots(); | |||
}); | |||
})(); | |||
</script> | |||
<div | |||
class="fgwiki-gallery" | |||
id="fgwiki-gallery-1" | |||
dir="rtl" | |||
aria-label="دماوند پلیمر تولید کننده مخازن پلی اتیلن" | |||
> | |||
<div class="fgwiki-gallery__viewport"> | |||
<div class="fgwiki-gallery__track"> | |||
<!-- اسلاید ۱ | مخازن پلی اتیلن --> | |||
<figure class="fgwiki-gallery__slide"> | |||
<img | |||
src="https://dl.faraghaib.ir/m/106/؟.jpg" | |||
alt="مخزن پلی اتیلن سه لایه دماوند پلیمر در ظرفیتهای مختلف" | |||
loading="eager" | |||
> | |||
<figcaption class="fgwiki-gallery__caption"> | |||
خرید مستقیم انواع مخزن پلی اتیلن در ظرفیتهای متنوع با بهترین قیمت کارخانه، گارانتی معتبر، ارسال سریع و کیفیت تضمینشده برای مصارف خانگی، صنعتی و کشاورزی. | |||
</figcaption> | |||
</figure> | |||
<!-- اسلاید ۲ | مخزن آب عمودی --> | |||
<figure class="fgwiki-gallery__slide"> | |||
<img | |||
src="https://dl.faraghaib.ir/m/106/؟.jpg" | |||
alt="مخزن آب پلی اتیلن عمودی سه لایه مقاوم در برابر اشعه UV" | |||
loading="lazy" | |||
> | |||
<figcaption class="fgwiki-gallery__caption"> | |||
انواع مخزن آب عمودی پلی اتیلن در ظرفیتهای مختلف، مقاوم در برابر نور خورشید، بدون تغییر رنگ و مناسب نصب در حیاط، پشتبام و محیطهای صنعتی. | |||
</figcaption> | |||
</figure> | |||
<!-- اسلاید ۳ | مخزن افقی --> | |||
<figure class="fgwiki-gallery__slide"> | |||
<img | |||
src="https://dl.faraghaib.ir/m/106/؟.jpg" | |||
alt="مخزن افقی پلی اتیلن دماوند پلیمر مناسب ذخیره آب و مایعات" | |||
loading="lazy" | |||
> | |||
<figcaption class="fgwiki-gallery__caption"> | |||
خرید مخزن افقی پلی اتیلن با طراحی استاندارد، مقاومت بالا در برابر ضربه و اشعه UV، مناسب ذخیره آب، مواد شیمیایی و انواع مایعات. | |||
</figcaption> | |||
</figure> | |||
<!-- اسلاید ۴ | مخزن زیرپله --> | |||
<figure class="fgwiki-gallery__slide"> | |||
<img | |||
src="https://dl.faraghaib.ir/m/106/؟.jpg" | |||
alt="خزن زیرپله پلی اتیلن مناسب آپارتمان و فضای محدود" | |||
loading="lazy" | |||
> | |||
<figcaption class="fgwiki-gallery__caption"> | |||
انواع مخزن زیرپله پلی اتیلن برای آپارتمانها و ساختمانهای مسکونی؛ بهترین راهکار ذخیره آب در فضاهای محدود با کیفیت تضمینشده. | |||
</figcaption> | |||
</figure> | |||
<!-- اسلاید ۵ | مخزن آسانرو --> | |||
<figure class="fgwiki-gallery__slide"> | |||
<img | |||
src="https://dl.faraghaib.ir/m/106/؟.jpg" | |||
alt="مخزن آسانرو پلی اتیلن دماوند پلیمر مناسب راهرو و درب باریک" | |||
loading="lazy" | |||
> | |||
<figcaption class="fgwiki-gallery__caption"> | |||
خرید مخزن آسانرو پلی اتیلن با طراحی ویژه برای عبور آسان از راهروها و دربهای کوچک، مناسب ساختمانهای مسکونی و پروژههای بازسازی. | |||
</figcaption> | |||
</figure> | |||
<!-- اسلاید ۶ | قیمت و خرید --> | |||
<figure class="fgwiki-gallery__slide"> | |||
<img | |||
src="https://dl.faraghaib.ir/m/106/؟.jpg" | |||
alt="خرید مخزن پلی اتیلن از کارخانه دماوند پلیمر با قیمت مناسب" | |||
loading="lazy" | |||
> | |||
<figcaption class="fgwiki-gallery__caption"> | |||
جدیدترین قیمت مخزن پلی اتیلن را مشاهده کنید و بدون واسطه از شرکت دماوند پلیمر خرید کنید. تضمین کیفیت، مشاوره تخصصی، ارسال سریع به سراسر ایران و بهترین قیمت تولیدکننده. | |||
</figcaption> | |||
</figure> | |||
</div> | |||
</div> | |||
<button | |||
class="fgwiki-gallery__button fgwiki-gallery__button--right" | |||
type="button" | |||
aria-label="نمایش اسلاید بعدی" | |||
> | |||
❯ | |||
</button> | |||
<button | |||
class="fgwiki-gallery__button fgwiki-gallery__button--left" | |||
type="button" | |||
aria-label="نمایش اسلاید قبلی" | |||
> | |||
❮ | |||
</button> | |||
<div class="fgwiki-gallery__dots" aria-label="ناوبری گالری"></div> | |||
</div> | |||
</ | |||
</html> | </html> | ||