Skip to content

Commit 09f21fb

Browse files
committed
added smooth scroll
1 parent e1abdba commit 09f21fb

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

wiki.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,16 @@ $('#split-bar').mousedown(function (e) {
2222
});
2323
$(document).mouseup(function (e) {
2424
$(document).unbind('mousemove');
25+
});
26+
27+
// animating scroll behavior of anchor links
28+
29+
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
30+
anchor.addEventListener('click', function (e) {
31+
e.preventDefault();
32+
33+
document.querySelector(this.getAttribute('href')).scrollIntoView({
34+
behavior: 'smooth'
35+
});
36+
});
2537
});

0 commit comments

Comments
 (0)