Update texts and add clickable enlarged image lightbox
This commit is contained in:
@@ -180,6 +180,42 @@ a:hover { text-decoration: underline; }
|
||||
transition: opacity 0.7s ease;
|
||||
}
|
||||
.slides img.active { opacity: 1; }
|
||||
.slides img.clickable { cursor: zoom-in; }
|
||||
|
||||
/* ---------------- Lightbox ---------------- */
|
||||
.lightbox {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
z-index: 100;
|
||||
background: rgba(0, 0, 0, 0.85);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 24px;
|
||||
opacity: 0;
|
||||
visibility: hidden;
|
||||
transition: opacity 0.25s ease, visibility 0.25s ease;
|
||||
}
|
||||
.lightbox.open { opacity: 1; visibility: visible; }
|
||||
.lightbox img {
|
||||
max-width: 92vw;
|
||||
max-height: 88vh;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
|
||||
}
|
||||
.lightbox-close {
|
||||
position: absolute;
|
||||
top: 18px;
|
||||
right: 24px;
|
||||
background: none;
|
||||
border: none;
|
||||
color: #fff;
|
||||
font-size: 2.2rem;
|
||||
line-height: 1;
|
||||
cursor: pointer;
|
||||
opacity: 0.85;
|
||||
}
|
||||
.lightbox-close:hover { opacity: 1; }
|
||||
|
||||
.slider-btn {
|
||||
position: absolute;
|
||||
|
||||
@@ -80,10 +80,44 @@
|
||||
});
|
||||
slider.addEventListener("mouseleave", restart);
|
||||
|
||||
images.forEach(function (img) {
|
||||
img.classList.add("clickable");
|
||||
img.addEventListener("click", function (ev) {
|
||||
ev.stopPropagation();
|
||||
openLightbox(img.src);
|
||||
});
|
||||
});
|
||||
|
||||
show();
|
||||
restart();
|
||||
});
|
||||
|
||||
// ---- Lightbox ----
|
||||
var lightbox = document.getElementById("lightbox");
|
||||
var lightboxImg = lightbox ? lightbox.querySelector("img") : null;
|
||||
var lightboxClose = lightbox ? lightbox.querySelector(".lightbox-close") : null;
|
||||
|
||||
function openLightbox(src) {
|
||||
if (!lightbox || !lightboxImg) return;
|
||||
lightboxImg.src = src;
|
||||
lightbox.classList.add("open");
|
||||
lightbox.setAttribute("aria-hidden", "false");
|
||||
}
|
||||
function closeLightbox() {
|
||||
if (!lightbox) return;
|
||||
lightbox.classList.remove("open");
|
||||
lightbox.setAttribute("aria-hidden", "true");
|
||||
lightboxImg.src = "";
|
||||
}
|
||||
if (lightbox) {
|
||||
lightbox.addEventListener("click", function (ev) {
|
||||
if (ev.target === lightbox || ev.target === lightboxClose) closeLightbox();
|
||||
});
|
||||
document.addEventListener("keydown", function (ev) {
|
||||
if (ev.key === "Escape") closeLightbox();
|
||||
});
|
||||
}
|
||||
|
||||
// ---- Flash mesajları ----
|
||||
setTimeout(function () {
|
||||
document.querySelectorAll(".flash").forEach(function (el) {
|
||||
|
||||
Reference in New Issue
Block a user