diff --git a/source/js/back_to_top.js b/source/js/back_to_top.js index e4235c8..cf56af1 100644 --- a/source/js/back_to_top.js +++ b/source/js/back_to_top.js @@ -143,6 +143,10 @@ $(document).ready(() => { $(window).scroll(update); $('#back-to-top').on('click', () => { - $('body, html').animate({ scrollTop: 0 }, 400); + if (CSS && CSS.supports && CSS.supports('(scroll-behavior: smooth)')) { + window.scroll({ top: 0, behavior: 'smooth' }); + } else { + $('body, html').animate({ scrollTop: 0 }, 400); + } }); });