chore(plugin): smoother scroll using scroll-behavior
This commit is contained in:
parent
7846071de2
commit
bbbfadefed
|
@ -143,6 +143,10 @@ $(document).ready(() => {
|
||||||
$(window).scroll(update);
|
$(window).scroll(update);
|
||||||
|
|
||||||
$('#back-to-top').on('click', () => {
|
$('#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);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue