1(function() { 2 3 'use strict'; 4 5 // define variables 6 var items = document.querySelectorAll(".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 var element = jQuery('#timeline'); 13 return ( 14 rect.top >= 0 && 15 rect.left >= 0 && 16 rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) && 17 rect.right <= (window.innerWidth || document.documentElement.clientWidth) 18 ); 19 20// return ( 21// rect.top >= 0 && 22// rect.left >= 0 && 23// rect.bottom <= (element.innerHeight()) && 24// rect.right <= (element.innerWidth()) 25 // ); 26 } 27 28 function callbackFunc() { 29 for (var i = 0; i < items.length; i++) { 30 if (isElementInViewport(items[i])) { 31 items[i].classList.add("in-view"); 32 } 33 } 34 } 35 36 // listen for events 37// var timeline = document.querySelectorAll(".timeline ul"); 38 window.addEventListener("load", callbackFunc); 39// timeline.addEventListener("resize", callbackFunc); 40 window.addEventListener("scroll", callbackFunc); 41 // jQuery(document).on('scroll','#timeline',callbackFunc); 42// jQuery(document).ready(function(){ 43// jQuery('.timeline ul').on('scroll',function(){ 44// console.log("in scroll"); 45// callbackFunc(); 46// }) 47// }); 48 49 //jQuery(document).on('load','#timeline ul',callbackFunc); 50 //jQuery(document).on('resize','#timeline ul',callbackFunc); 51 //jQuery(document).on('scroll','#timeline ul',callbackFunc); 52 53 jQuery('#timeline').on('load',function(){ 54 callbackFunc(); 55 }); 56 57 jQuery('#timeline').on('scroll',function(){ 58 callbackFunc(); 59 }); 60})();
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.