-
Notifications
You must be signed in to change notification settings - Fork 0
/
blog.js
47 lines (40 loc) · 1.24 KB
/
blog.js
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
41
42
43
44
45
46
47
// scroll button
let mybutton = document.getElementById("upbtn");
window.onscroll = function () {
scrollFunction();
};
function scrollFunction() {
if (
document.body.scrollTop > 20 ||
document.documentElement.scrollTop > 20
) {
mybutton.style.display = "block";
} else {
mybutton.style.display = "none";
}
}
function topFunction() {
document.body.scrollTop = 0;
document.documentElement.scrollTop = 0;
}
// Function to prompt logout confirmation
function confirmLogout(event) {
// Prevent the default behavior of the link
event.preventDefault();
// Prompt user with a confirmation dialog
let logoutConfirmed = confirm("Are you sure you want to log out?");
// If user confirms logout, redirect to logout page
if (logoutConfirmed) {
window.location.href = "LogInPage.html";
}
}
// Add event listener to the "Log Out" link
let logoutLink = document.querySelector("nav .nav-links li:last-child a");
logoutLink.addEventListener("click", confirmLogout);
//Image Slider
var swiper = new Swiper('.swiper-container', {
navigation: {
nextEl: '.swiper-button-next',
prevEl: '.swiper-button-prev',
},
});