-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
52 lines (45 loc) · 1.48 KB
/
index.html
File metadata and controls
52 lines (45 loc) · 1.48 KB
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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>https://verdant-piroshki-d959e9.netlify.app/</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="main.css">
</head>
<body>
<nav>
<div id="navbar">
<p class="logo"> LOGO</p>
<a href="#HOME">HOME</a>
<a href="#ABOUT US">ABOUT US</a>
<a href="#SERVICES">SERVICES</a>
<a href="#BLOG">BLOG</a>
<a href="#CONTACT US">CONTACT US</a>
</div>
</nav>
<div class="banner">
<div class="banner-overlay">
<h4>Professional Cleaning Services</h4>
<h1>SO FRESH AND SO CLEAN...</h1>
<h1>WE PROMISE!</h1>
</div>
<script>
// When the user scrolls the page, execute myFunction
window.onscroll = function() {myFunction()};
// Get the navbar
var navbar = document.getElementById("navbar");
// Get the offset position of the navbar
var sticky = navbar.offsetTop;
// Add the sticky class to the navbar when you reach its scroll position. Remove "sticky" when you leave the scroll position
function myFunction() {
if (window.pageYOffset >= sticky) {
navbar.classList.add("sticky")
} else {
navbar.classList.remove("sticky");
}
}
</script>
</body>
</html>