Skip to content

Commit 555a3dd

Browse files
committed
feat: scroll to top on logo click
1 parent d07f772 commit 555a3dd

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

css/index.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ nav {
6262

6363
.logo-content{
6464
display: inherit;
65+
cursor: pointer;
6566
}
6667

6768
.nav-links {

script.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,13 @@ function toggleMenu() {
1313
hamburgerIcon.style.display = "block";
1414
xIcon.style.display = "none";
1515
}
16-
}
16+
}
17+
18+
// scroll to top when clicking the logo
19+
document.querySelector(".logo").addEventListener("click", () => {
20+
window.scrollTo({
21+
top: 0,
22+
behavior: "smooth"
23+
})
24+
25+
})

0 commit comments

Comments
 (0)