Skip to content

Commit 3dc0125

Browse files
committed
smooth anchor scroll
1 parent 46b9ad2 commit 3dc0125

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
</div>
2323
</a>
2424
<div class="navbar">
25-
<a href="#donate">
25+
<a href="#donate" onclick="scrollToId('donate')">
2626
<div class="link">↓ Donate</div>
2727
</a>
2828
<a href="https://github.com/ModuleArt">

js/index.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,8 @@ $(document).ready(function () {
1313
document.getElementById("copyright").innerHTML = "Copyright © " + new Date().getFullYear() + " Module Art";
1414
});
1515
}
16-
});
16+
});
17+
18+
function scrollToId(id) {
19+
$("body,html").animate({ scrollTop: document.getElementById(id).offsetTop }, 800);
20+
}

0 commit comments

Comments
 (0)