| 1 |
- const u=i=>{const d=document.querySelectorAll(".wenzi"),l=document.querySelectorAll(".sub-dh");function n(t){const e=t.getBoundingClientRect(),c=window.innerHeight,r=e.top+e.height/2;return r>=c/4&&r<=c*3/4}function o(t){const e=t.getBoundingClientRect();return e.bottom<0||e.top>window.innerHeight}function s(){d.forEach(t=>{n(t)?(i&&i(!0,t),t.classList.add("text-active")):o(t)}),l.forEach(t=>{n(t)?(i&&i(!0,t),t.classList.add("sub-title-active")):o(t)})}window.addEventListener("scroll",s),s()};export{u as i};
|