-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
67 lines (58 loc) · 1.95 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
67
////////////////////////////////////////////////////////////////
const words = [`"Hygienic"`];
let index = 0;
function animateWords() {
let wordElement = document.getElementById("word");
const currentWord = words[index];
const nextWord = words[(index + 1) % words.length];
wordElement.textContent = currentWord;
setTimeout(() => {
wordElement.textContent = nextWord;
index = (index + 1) % words.length;
animateWords();
}, 2500);
}
animateWords();
/////////////////////////////////////////////////////
//preloader
var loader = document.getElementById("preloader");
window.addEventListener("load", function () {
loader.style.display = "none";
});
////////////////////////////////////////////////////
//changing names to 1, 2, 3, 4 when screensize is small
// Get the span elements
var hkButton = document.querySelector(".hk-button");
var dButton = document.querySelector(".d-button");
var kButton = document.querySelector(".k-button");
var lButton = document.querySelector(".l-button");
// Function to change the text content
function updateTextContent() {
if (window.matchMedia("(max-width: 950px)").matches) {
hkButton.textContent = "1";
dButton.textContent = "2";
kButton.textContent = "3";
lButton.textContent = "4";
} else {
hkButton.textContent = "housekeeping";
dButton.textContent = "disinfection";
kButton.textContent = "kitchenclean";
lButton.textContent = "laundrycare";
}
}
// Initial call to update text content
updateTextContent();
// Add resize event listener to update text content
window.addEventListener("resize", updateTextContent);
///////////////////////////////////////////////////
//navbar collapse
var MenuItems = document.getElementById("MenuItemsNB");
MenuItems.style.maxHeight = "0px";
function menutoggle() {
if (MenuItems.style.maxHeight == "0px") {
MenuItems.style.maxHeight = "200px";
} else {
MenuItems.style.maxHeight = "0px";
}
}
////////////////////////////////////////////////////