1console.log('from test.js'); 2 3(function(){ 4 // Vertical Timeline - by CodyHouse.co 5 function VerticalTimeline( element ) { 6 this.element = element; 7 this.blocks = this.element.getElementsByClassName("cd-timeline__block"); 8 this.images = this.element.getElementsByClassName("cd-timeline__img"); 9 this.contents = this.element.getElementsByClassName("cd-timeline__content"); 10 this.offset = 0.8; 11 this.hideBlocks(); 12 }; 13 14 VerticalTimeline.prototype.hideBlocks = function() { 15 if ( !"classList" in document.documentElement ) { 16 return; // no animation on older browsers 17 } 18 //hide timeline blocks which are outside the viewport 19 var self = this; 20 for( var i = 0; i < this.blocks.length; i++) { 21 (function(i){ 22 if( self.blocks[i].getBoundingClientRect().top > window.innerHeight*self.offset ) { 23 self.images[i].classList.add("cd-timeline__img--hidden"); 24 self.contents[i].classList.add("cd-timeline__content--hidden"); 25 } 26 })(i); 27 } 28 }; 29 30 VerticalTimeline.prototype.showBlocks = function() { 31 if ( ! "classList" in document.documentElement ) { 32 return; 33 } 34 var self = this; 35 for( var i = 0; i < this.blocks.length; i++) { 36 (function(i){ 37 if( self.contents[i].classList.contains("cd-timeline__content--hidden") && self.blocks[i].getBoundingClientRect().top <= window.innerHeight*self.offset ) { 38 // add bounce-in animation 39 self.images[i].classList.add("cd-timeline__img--bounce-in"); 40 self.contents[i].classList.add("cd-timeline__content--bounce-in"); 41 self.images[i].classList.remove("cd-timeline__img--hidden"); 42 self.contents[i].classList.remove("cd-timeline__content--hidden"); 43 } 44 })(i); 45 } 46 }; 47 48 var verticalTimelines = document.getElementsByClassName("js-cd-timeline"), 49 verticalTimelinesArray = [], 50 scrolling = false; 51 if( verticalTimelines.length > 0 ) { 52 for( var i = 0; i < verticalTimelines.length; i++) { 53 (function(i){ 54 verticalTimelinesArray.push(new VerticalTimeline(verticalTimelines[i])); 55 })(i); 56 } 57 58 //show timeline blocks on scrolling 59 window.addEventListener("scroll", function(event) { 60 if( !scrolling ) { 61 scrolling = true; 62 (!window.requestAnimationFrame) ? setTimeout(checkTimelineScroll, 250) : window.requestAnimationFrame(checkTimelineScroll); 63 } 64 }); 65 } 66 67 function checkTimelineScroll() { 68 verticalTimelinesArray.forEach(function(timeline){ 69 timeline.showBlocks(); 70 }); 71 scrolling = false; 72 }; 73})();
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.