-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.js
46 lines (35 loc) · 1.23 KB
/
index.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
const hamburger = document.getElementById('hamburger');
const menu = document.getElementById('menu');
hamburger.addEventListener('click', () => {
menu.classList.toggle('active');
});
const typewriterText = "DISCOVER THE COLOURFUL WORLD";
let index = 0;
function typeWriter() {
const textElement = document.getElementById('top-p-main');
if (index < typewriterText.length) {
textElement.innerHTML += typewriterText.charAt(index);
index++;
setTimeout(typeWriter, 70);
}
}
window.addEventListener('load', typeWriter);
const scrollButton = document.getElementById('landing-main-button');
scrollButton.addEventListener('click', () => {
const targetElement = document.getElementById('loactions-part');
if (targetElement) {
targetElement.scrollIntoView({ behavior: 'smooth' });
}})
// navbar scrolling background color effect
// JavaScript to add and remove the "scrolled" class on scroll
$(document).ready(function () {
$(window).scroll(function () {
if ($(this).scrollTop() > 0) {
$(".navbar").addClass("scrolled");
$(".navbar-text").addClass("white-text");
} else {
$(".navbar").removeClass("scrolled");
$(".navbar-text").removeClass("white-text");
}
});
});