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
|
// Create a link element
|
||||||
const link = document.querySelector('.book-mark-link');
|
const link = document.querySelector('.book-mark-link');
|
||||||
// Scroll event
|
// 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
|
// Register beforeunload event when the trigger is auto
|
||||||
if (trigger === 'auto') {
|
if (trigger === 'auto') {
|
||||||
// Register beforeunload event
|
// Register beforeunload event
|
||||||
|
|||||||
@ -57,5 +57,5 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||||||
|
|
||||||
updateFooterPosition();
|
updateFooterPosition();
|
||||||
window.addEventListener('resize', updateFooterPosition);
|
window.addEventListener('resize', updateFooterPosition);
|
||||||
window.addEventListener('scroll', updateFooterPosition);
|
window.addEventListener('scroll', updateFooterPosition, { passive: true });
|
||||||
});
|
});
|
||||||
|
|||||||
@ -189,7 +189,7 @@ NexT.utils = {
|
|||||||
index--;
|
index--;
|
||||||
}
|
}
|
||||||
this.activateNavByIndex(index);
|
this.activateNavByIndex(index);
|
||||||
});
|
}, { passive: true });
|
||||||
|
|
||||||
backToTop && backToTop.addEventListener('click', () => {
|
backToTop && backToTop.addEventListener('click', () => {
|
||||||
window.anime({
|
window.anime({
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user