diff --git a/assets/css/_addon/main.scss b/assets/css/_addon/main.scss index a30722a..7fa3b5f 100644 --- a/assets/css/_addon/main.scss +++ b/assets/css/_addon/main.scss @@ -46,8 +46,9 @@ html[mode=dark] { } } -html, body { +:root { font-size: 16px; + scroll-behavior: smooth; } body { diff --git a/assets/js/_commons/back-to-top.js b/assets/js/_commons/back-to-top.js index 21a91da..377e35f 100644 --- a/assets/js/_commons/back-to-top.js +++ b/assets/js/_commons/back-to-top.js @@ -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; }); });