Jump to the anchor position smoothly
This commit is contained in:
parent
fa310d3190
commit
dfba411d61
2 changed files with 5 additions and 7 deletions
|
@ -46,8 +46,9 @@ html[mode=dark] {
|
|||
}
|
||||
}
|
||||
|
||||
html, body {
|
||||
:root {
|
||||
font-size: 16px;
|
||||
scroll-behavior: smooth;
|
||||
}
|
||||
|
||||
body {
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
/*
|
||||
Reference: https://bootsnipp.com/snippets/featured/link-to-top-page
|
||||
*/
|
||||
|
||||
$(function() {
|
||||
$(window).scroll(function() {
|
||||
$(window).scroll(() => {
|
||||
if ($(this).scrollTop() > 50 &&
|
||||
$("#sidebar-trigger").css("display") === "none") {
|
||||
$("#back-to-top").fadeIn();
|
||||
|
@ -12,10 +11,8 @@ $(function() {
|
|||
}
|
||||
});
|
||||
|
||||
$("#back-to-top").click(function() {
|
||||
$("body,html").animate({
|
||||
scrollTop: 0
|
||||
}, 800);
|
||||
$("#back-to-top").click(() => {
|
||||
$("body,html").scrollTop(0);
|
||||
return false;
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue