PageSourceSearch

https://wildsalmoncenter.org/wp-content/themes/wildsalmon/src/js/libraries/animation-on-scroll.js?ver=1.0.26

js wildsalmoncenter.org collected 2026-09-24 17:37:06 UTC 1,174 bytes, 39 lines download raw bytes

1document.addEventListener("DOMContentLoaded", function () {
2
3const animItems = document.querySelectorAll( '._anim-items' );
4
5if ( animItems.length > 0 ) {
6	window.addEventListener( 'scroll', animOnScroll );
7
8	function animOnScroll() {
9		for ( let index = 0; index < animItems.length; index++ ) {
10			const animItem = animItems[ index ];
11			const animItemHeight = animItem.offsetHeight;
12			const animItemOffset = offset( animItem ).top;
13			const animStart = 6;
14			let animItemPoint = window.innerHeight + animItemHeight / animStart;
15			if ( animItemHeight < window.innerHeight ) {
16				animItemPoint = window.innerHeight - window.innerHeight / animStart;
17			}
18
19			if ( ( scrollY > animItemOffset - animItemPoint ) && scrollY < ( animItemOffset + animItemHeight ) ) {
20				animItem.classList.add( '_active' );
21			} 
22		}
23	}
24
25	function offset( el ) {
26		const rect = el.getBoundingClientRect(),
27			scrollLeft = window.pageXOffset || document.documentElement.scrollLeft,
28			scrollTop = window.pageYOffset || document.documentElement.scrollTop;
29		return {
30			top: rect.top + scrollTop,
31			left: rect.left + scrollLeft,
32		};
33	}
34
35	setTimeout( () => {
36		animOnScroll();
37	}, 300 );
38}
39});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.