1$(document).ready(function(){ 2 3 'use strict'; 4 5 // define variables 6 var items = document.querySelectorAll(".main-timeline li"); 7 8 // check if an element is in viewport 9 // http://stackoverflow.com/questions/123999/how-to-tell-if-a-dom-element-is-visible-in-the-current-viewport 10 function isElementInViewport(el) { 11 var rect = el.getBoundingClientRect(); 12 return ( 13 rect.top >= 0 && 14 rect.left >= 0 && 15 rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) && 16 rect.right <= (window.innerWidth || document.documentElement.clientWidth) 17 ); 18 } 19 20 function callbackFunc() { 21 for (var i = 0; i < items.length; i++) { 22 if (isElementInViewport(items[i])) { 23 items[i].classList.add("in-view"); 24 } 25 } 26 } 27 28 // listen for events 29 window.addEventListener("load", callbackFunc); 30 window.addEventListener("resize", callbackFunc); 31 window.addEventListener("scroll", callbackFunc); 32 33})
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.