Skip to content

Commit 1740bc8

Browse files
committed
12-Scroll Trigger
1 parent 7a6efed commit 1740bc8

File tree

5 files changed

+73
-2
lines changed

5 files changed

+73
-2
lines changed

public/css/tailwind.css

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21568,13 +21568,37 @@ a:hover {
2156821568
padding-bottom: 0;
2156921569
}
2157021570

21571+
#mainMenu li a:hover {
21572+
--text-opacity: 1;
21573+
color: #feb2b2;
21574+
color: rgba(254, 178, 178, var(--text-opacity));
21575+
}
21576+
2157121577
#mainMenu li {
2157221578
margin-right: 1rem;
2157321579
}
2157421580

2157521581
#mainMenu li:last-child {
2157621582
margin-right: 0;
2157721583
}
21584+
21585+
.stickyNav {
21586+
--bg-opacity: 1 !important;
21587+
background-color: #000 !important;
21588+
background-color: rgba(0, 0, 0, var(--bg-opacity)) !important;
21589+
padding-top: 0.75rem !important;
21590+
padding-bottom: 0.75rem !important;
21591+
}
21592+
21593+
.stickyNav logo {
21594+
height: 1.5rem !important;
21595+
}
21596+
21597+
.stickyNav #mainMenu li a:hover {
21598+
--text-opacity: 1;
21599+
color: #e53e3e;
21600+
color: rgba(229, 62, 62, var(--text-opacity));
21601+
}
2157821602
}
2157921603

2158021604
/*footer*/

public/header.html

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
>
1515
<div class="flex justify-between items-center w-full">
1616
<h1>
17-
<a href="#">
17+
<a id="logo" href="#">
1818
<span class="hidden">Boom</span>
1919
<svg
2020
xmlns="http://www.w3.org/2000/svg"
@@ -53,6 +53,25 @@ <h1>
5353
</ul>
5454
</nav>
5555
</header>
56+
57+
<div class="fixed z-30 bottom-0 right-0 mr-6 mb-6">
58+
<a id="back2Top" href="#" class="hidden text-white bg-red-800 bg-opacity-50 rounded-md">
59+
<span class="hidden">Back to Top</span>
60+
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 24 24" class="h-10 w-10">
61+
<path fill="currentColor" d="M7.41,15.41L12,10.83L16.59,15.41L18,14L12,8L6,14L7.41,15.41Z" />
62+
</svg>
63+
</a>
64+
</div>
65+
66+
<div class="h-screen-1/3 bg-teal-900"></div>
67+
<div class="h-screen-1/3 bg-teal-800"></div>
68+
<div class="h-screen-1/3 bg-teal-700"></div>
69+
<div class="h-screen-1/3 bg-teal-600"></div>
70+
<div class="h-screen-1/3 bg-teal-500"></div>
71+
<div class="h-screen-1/3 bg-teal-400"></div>
72+
<div class="h-screen-1/3 bg-teal-300"></div>
73+
<div class="h-screen-1/3 bg-teal-200"></div>
74+
<div class="h-screen-1/3 bg-teal-100"></div>
5675
<script src="./js/index.js"></script>
5776
</body>
5877
</html>

public/index.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
>
1515
<div class="flex justify-between items-center w-full">
1616
<h1>
17-
<a href="#">
17+
<a id="logo" href="#">
1818
<span class="hidden">Boom</span>
1919
<svg
2020
xmlns="http://www.w3.org/2000/svg"
@@ -53,6 +53,7 @@ <h1>
5353
</ul>
5454
</nav>
5555
</header>
56+
5657
<main>
5758
<!--Landing page Full Product Hero-->
5859
<section class="relative h-screen-2/3 lg:h-screen flex flex-col justify-end lg:flex-row lg:items-center">

public/js/index.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,20 @@ function toggleBurger() {
1515
});
1616
}
1717

18+
window.addEventListener('scroll', (e) => {
19+
if (window.scrollY >= 400) {
20+
nav.classList.add('stickyNav');
21+
22+
back2Top.classList.remove('hidden');
23+
back2Top.classList.add('block');
24+
} else {
25+
nav.classList.remove('stickyNav');
26+
27+
back2Top.classList.remove('block');
28+
back2Top.classList.add('hidden');
29+
}
30+
});
31+
1832
mobileMenu.addEventListener('click', (e) => {
1933
e.preventDefault();
2034

src/css/tailwind.css

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,25 @@ a:hover {
7272
#mainMenu li a {
7373
@apply py-0;
7474
}
75+
#mainMenu li a:hover {
76+
@apply text-red-300;
77+
}
7578
#mainMenu li {
7679
@apply mr-4;
7780
}
7881
#mainMenu li:last-child {
7982
@apply mr-0;
8083
}
84+
85+
.stickyNav {
86+
@apply bg-black py-3 !important;
87+
}
88+
.stickyNav logo {
89+
@apply h-6 !important;
90+
}
91+
.stickyNav #mainMenu li a:hover {
92+
@apply text-red-600;
93+
}
8194
}
8295
/*footer*/
8396
footer ul li h4 {

0 commit comments

Comments
 (0)