${img.caption || ""}
${slidesHTML}
`;
el.appendChild(wrapper);
initSlider(el);
```
}
function injectStyles() {
const style = document.createElement("style");
style.innerHTML = `
.ws-wrapper { position: relative; overflow: hidden; }
```
.ws-slide {
position: absolute;
width: 100%;
opacity: 0;
transition: opacity 1s ease;
}
.ws-slide.active {
opacity: 1;
position: relative;
z-index: 2;
}
.ws-slide img {
width: 100%;
transform: scale(1);
transition: transform 6s ease;
}
.ws-slide.kenburns img {
transform: scale(1.08);
}
.ws-caption {
position: absolute;
bottom: 20px;
left: 20px;
color: #fff;
font-size: 16px;
background: rgba(0,0,0,0.4);
padding: 8px 12px;
}
.ws-prev, .ws-next {
position: absolute;
top: 50%;
transform: translateY(-50%);
background: rgba(0,0,0,0.4);
color: #fff;
border: none;
padding: 10px;
cursor: pointer;
z-index: 3;
}
.ws-prev { left: 10px; }
.ws-next { right: 10px; }
.ws-progress {
position: absolute;
bottom: 0;
left: 0;
width: 100%;
height: 3px;
background: rgba(255,255,255,0.2);
}
.ws-progress-bar {
width: 0%;
height: 100%;
background: #fff;
}
.ws-lightbox {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0,0,0,0.95);
display: flex;
align-items: center;
justify-content: center;
z-index: 9999;
}
.ws-lightbox img {
max-width: 90%;
max-height: 90%;
}
`;
document.head.appendChild(style);
```
}
document.addEventListener("DOMContentLoaded", () => {
injectStyles();
document.querySelectorAll(".weeby-slider").forEach(buildSlider);
});
})();