mirror of
https://github.com/next-theme/hexo-theme-next.git
synced 2026-01-17 18:22:33 +00:00
Use passive scroll listeners (#282)
This commit is contained in:
parent
f03b7ce306
commit
23f518f1e7
@ -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
|
||||
|
||||
@ -57,5 +57,5 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
|
||||
updateFooterPosition();
|
||||
window.addEventListener('resize', updateFooterPosition);
|
||||
window.addEventListener('scroll', updateFooterPosition);
|
||||
window.addEventListener('scroll', updateFooterPosition, { passive: true });
|
||||
});
|
||||
|
||||
@ -189,7 +189,7 @@ NexT.utils = {
|
||||
index--;
|
||||
}
|
||||
this.activateNavByIndex(index);
|
||||
});
|
||||
}, { passive: true });
|
||||
|
||||
backToTop && backToTop.addEventListener('click', () => {
|
||||
window.anime({
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user