文件
nahaichuan/public/assets/addons/official/js/header-scroll.js

23 行
537 B
JavaScript

/* Keep the public navigation readable while content passes beneath it. */
(function () {
'use strict';
var root = document.documentElement;
var pending = false;
function update() {
root.classList.toggle('nhc-nav-scrolled', window.scrollY > 40);
pending = false;
}
function onScroll() {
if (!pending) {
pending = true;
window.requestAnimationFrame(update);
}
}
update();
window.addEventListener('scroll', onScroll, { passive: true });
window.addEventListener('pageshow', update);
}());