Use passive scroll listeners (#282)

This commit is contained in:
2021-05-31 20:12:42 +08:00 committed by GitHub
parent f03b7ce306
commit 23f518f1e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 3 deletions

View File

@ -26,7 +26,7 @@ document.addEventListener('DOMContentLoaded', () => {
// Create a link element
const link = document.querySelector('.book-mark-link');
// Scroll event
window.addEventListener('scroll', () => link.classList.toggle('book-mark-link-fixed', window.scrollY === 0));
window.addEventListener('scroll', () => link.classList.toggle('book-mark-link-fixed', window.scrollY === 0), { passive: true });
// Register beforeunload event when the trigger is auto
if (trigger === 'auto') {
// Register beforeunload event

View File

@ -57,5 +57,5 @@ document.addEventListener('DOMContentLoaded', () => {
updateFooterPosition();
window.addEventListener('resize', updateFooterPosition);
window.addEventListener('scroll', updateFooterPosition);
window.addEventListener('scroll', updateFooterPosition, { passive: true });
});

View File

@ -189,7 +189,7 @@ NexT.utils = {
index--;
}
this.activateNavByIndex(index);
});
}, { passive: true });
backToTop && backToTop.addEventListener('click', () => {
window.anime({