-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
72 lines (61 loc) · 1.77 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
68
69
70
71
72
const popup = document.querySelector(".pop-up");
const closeBtn = document.querySelector(".fa-circle-xmark");
const daftarBtn = document.querySelectorAll(".daftar");
const scrollBtn = document.querySelector(".scroll-top");
const bars = document.querySelector(".bars");
const navbar = document.querySelector(".navbar");
const sendWA = document.querySelector("button.send")
const logo = document.querySelector(".logo")
if (document.body.offsetWidth == 600) {
console.log('ok')
}
navbar.classList.add("right")
function checkWidth() {
if ($(window).width() > 600) {
navbar.classList.remove("right");
}
}
setInterval(checkWidth, 100)
popup.classList.add("none");
window.addEventListener("scroll", (event) => {
var scroll = this.scrollY;
if (scroll > 400) {
scrollBtn.classList.remove('none');
} else {
scrollBtn.classList.add('none');
}
});
daftarBtn.forEach(e => {
e.addEventListener("click", () => {
popup.classList.toggle('none')
})
})
closeBtn.addEventListener('click', () => {
popup.classList.add('none')
})
scrollBtn.addEventListener('click', () => {
window.scrollTo(0, 0);
})
logo.addEventListener('click', () => {
window.scrollTo(0, 0);
})
bars.addEventListener("click", () => {
navbar.classList.toggle("right");
document.querySelector(".nav-content").childNodes.forEach(e => {
e.addEventListener("click", () => {
navbar.classList.add("right");
})
})
})
// send WA
sendWA.addEventListener("click", () => {
var text = "Halo Little Cloud Mandarin Course, saya tertarik dengan kursus Little Cloud Mandarin"
window.open(`https://api.whatsapp.com/send/?phone=6287842174971&text=${text}`, '_blank')
})
// change text
var typed = new Typed(".auto-type", {
strings: ["Online", "Offline"],
typeSpeed: 150,
backSpeed: 150,
loop: true
})