-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
66 lines (51 loc) · 1.75 KB
/
script.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
// Set the interval for the carousel to slide automatically
var interval = 5000; // in milliseconds
// Get the carousel element
var carousel = document.querySelector('#myCarousel');
// Get the carousel items
var items = carousel.querySelectorAll('.carousel-item');
// Set the current slide to the first item
var currentSlide = 0;
// Start the carousel
var slideInterval = setInterval(nextSlide, interval);
// Function to move to the next slide
function nextSlide() {
// Hide the current slide
items[currentSlide].classList.remove('active');
// Move to the next slide
currentSlide = (currentSlide + 1) % items.length;
// Show the next slide
items[currentSlide].classList.add('active');
}
function toggleBtn() {
let displayHandling = document.getElementById("profile_List");
if (displayHandling.style.display === "block") {
displayHandling.style.display = "none";
displayHandling.style.width = '200px'
} else {
displayHandling.style.display = "block";
}
}
var prevScrollpos = window.pageYOffset;
window.onscroll = function() {
var currentScrollPos = window.pageYOffset;
if (prevScrollpos > currentScrollPos) {
document.querySelector("header").style.top = "0";
} else {
document.querySelector("header").style.top = "-7.2rem";
}
prevScrollpos = currentScrollPos;
}
//This is for the simple buttons going to the other pages
function goToPage(url) {
window.location.href = url;
}
const form = document.querySelector('.newsLetterForm');
const emailInput = form.querySelector('input[type="email"]');
form.addEventListener('submit', (event) => {
event.preventDefault();
const email = emailInput.value;
localStorage.setItem('newsletterEmail', email);
emailInput.value = '';
alert('You are now subscribed to our newsletter!');
});