Skip to content

Commit c63bf77

Browse files
committed
Added scroll-down button
1 parent ad7702c commit c63bf77

2 files changed

Lines changed: 38 additions & 0 deletions

File tree

home-style.css

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,30 @@ main {
107107
text-align: center;
108108
}
109109

110+
.scroll-button {
111+
position: fixed;
112+
bottom: 20px;
113+
left: 50%;
114+
transform: translateX(-50%);
115+
width: 60px;
116+
height: 60px;
117+
border-radius: 50%;
118+
background-color: #1e1b1e;
119+
border-color: aqua;
120+
border-width: thick;
121+
cursor: pointer;
122+
123+
display: flex;
124+
justify-content: center;
125+
align-items: center;
126+
}
127+
128+
.scroll-button ion-icon {
129+
color: white;
130+
font-size: 24px;
131+
transform: rotate(180deg);
132+
}
133+
110134
.project_text {
111135
color: aquamarine;
112136
left: 50%;

home.html

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,27 @@ <h2>Logo</h2>
2626
<div class="bg-text">
2727
<h1>Welcome to Neeoder-code</h1>
2828
</div>
29+
<button class="scroll-button">
30+
<ion-icon name="chevron-up-outline"></ion-icon>
31+
</button>
2932
</div>
3033
<div class="project_section">
3134
<div class="project_text">
3235
<h1>My projects</h1>
3336
</div>
3437
</div>
3538
</main>
39+
<script>
40+
const scrollButton = document.querySelector('.scroll-button');
41+
const targetSection = document.querySelector('.project_section');
42+
43+
scrollButton.addEventListener('click', () => {
44+
window.scrollTo({
45+
top: targetSection.offsetTop,
46+
behavior: 'smooth',
47+
});
48+
});
49+
</script>
3650
<script type="module" src="https://unpkg.com/ionicons@7.1.0/dist/ionicons/ionicons.esm.js"></script>
3751
<script nomodule src="https://unpkg.com/ionicons@7.1.0/dist/ionicons/ionicons.js"></script>
3852
</body>

0 commit comments

Comments
 (0)