chore(plugin): smoother scroll using scroll-behavior

This commit is contained in:
ppoffice 2020-09-13 00:41:15 -04:00
parent 7846071de2
commit bbbfadefed
No known key found for this signature in database
GPG Key ID: B33335481CC0D498
1 changed files with 5 additions and 1 deletions

View File

@ -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);
}
});
});