1'use strict'; 2const animationClassName = [ 3 'fade_in', 'fadeIn', 'fadeUp', 'fadeDown', 'fadeLeft', 'fadeRight', 'fadeInFast', 'fadeUpFast', 'fadeDownFast', 4 'fadeLeftFast', 'fadeRightFast' 5]; 6 7// è¦ç´ ããã¥ã¼ãã¼ãå ã«å ¥ã£ã¦ãããå¤å®ãããããã¢ãã¡ã¼ã·ã§ã³ãéå§ããcssã¯ã©ã¹ã追å ãã 8function animateParts(nodeList) { 9 // ãã¥ã¼ãã¼ãã®ç¸¦å¹ 10 const viewHeight = window.innerHeight; 11 // ãã¥ã¼ãã¼ãã®ä¸ç«¯ã®ä½ç½® 12 const viewTop = Math.round(window.scrollY); 13 // ãã¥ã¼ãã¼ãã®ä¸ç«¯ã®ä½ç½® 14 const viewBottom = viewTop + viewHeight; 15 16 // ãã¼ã¸ã®ç¸¦å¹ 17 const bodyHeight = document.body.clientHeight; 18 19 // ã¢ãã¡ã¼ã·ã§ã³ãåçããæã«ãè¦ç´ ããã¥ã¼ãã¼ãã«å ¥ã£ã¦ãããã¯ã»ã«æ° 20 const startPoint = 150; 21 22 for (var i=0, length=nodeList.length; i<length; i++) { 23 // 対象ã®è¦ç´ ã®ããã¥ã¼ãã¼ãã®ä¸ç«¯ããã®ä½ç½® 24 const elementTop = nodeList[i].getBoundingClientRect().top; 25 26 if ( 27 // è¦ç´ ããã¥ã¼ãã¼ãã«ããç¨åº¦å ¥ã£ãã 28 (elementTop <= viewHeight - startPoint) 29 // ãã¼ã¸ã®ä¸ç«¯ã¾ã§ã¹ã¯ãã¼ã«ãããã 30 || (bodyHeight <= viewBottom) 31 ) { 32 nodeList[i].classList.add('animation_start'); 33 } 34 } 35} 36 37function setAnimation() { 38 for (var i=0, length=animationClassName.length; i<length;i++) { 39 const animatedParts = document.getElementsByClassName(animationClassName[i]); 40 animateParts(animatedParts); 41 } 42} 43window.addEventListener('load', setAnimation); 44window.addEventListener('scroll', setAnimation);
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.