-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
40 lines (34 loc) · 1.15 KB
/
Copy pathscript.js
File metadata and controls
40 lines (34 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
document.addEventListener("DOMContentLoaded", function () {
let currentSlide = 0;
const slides = document.querySelectorAll('.slide');
function showSlide(index) {
slides.forEach((slide, i) => {
slide.classList.remove('active');
if (i === index) {
slide.classList.add('active');
}
});
}
function changeSlide(direction) {
currentSlide += direction;
if (currentSlide < 0) {
currentSlide = slides.length - 1;
} else if (currentSlide >= slides.length) {
currentSlide = 0;
}
showSlide(currentSlide);
}
function autoChangeSlide() {
currentSlide = (currentSlide + 1) % slides.length;
showSlide(currentSlide);
}
setInterval(autoChangeSlide, 3000); // Change image every 3 seconds
});
function handleBookNowClick() {
const isLoggedIn = localStorage.getItem("isLoggedIn");
if (isLoggedIn === "true") {
window.location.href = "rooms.html"; // user is logged in
} else {
window.location.href = "login.html"; // redirect to login
}
}