1var docElem = window.document.documentElement; 2 3 function getViewportH() { 4 var client = docElem['clientHeight'], 5 inner = window['innerHeight']; 6 7 if( client < inner ) 8 return inner; 9 else 10 return client; 11 } 12 13 function scrollY() { 14 return window.pageYOffset || docElem.scrollTop; 15 } 16 17 function getOffset( el ) { 18 var offsetTop = 0, offsetLeft = 0; 19 do { 20 if ( !isNaN( el.offsetTop ) ) { 21 offsetTop += el.offsetTop; 22 } 23 if ( !isNaN( el.offsetLeft ) ) { 24 offsetLeft += el.offsetLeft; 25 } 26 } while( el = el.offsetParent ) 27 28 return { 29 top : offsetTop, 30 left : offsetLeft 31 } 32 } 33 34 function inViewport( el, h ) { 35 var elH = el.offsetHeight, 36 scrolled = scrollY(), 37 viewed = scrolled + getViewportH(), 38 elTop = getOffset(el).top, 39 elBottom = elTop + elH, 40 // if 0, the element is considered in the viewport as soon as it enters. 41 // if 1, the element is considered in the viewport only when it's fully inside 42 // value in percentage (1 >= h >= 0) 43 h = h || 0; 44 45 return (elTop + elH * h) <= viewed && (elBottom) >= scrolled; 46 } 47(function ( $ ) { 48 49 'use strict'; 50 51 $.fn.animateIn = function(){ 52 53 var el = $(this); 54 var height = $(window).innerHeight(); 55 56 el.css('opacity', '0'); 57 58 $(window).scroll(function(){ 59 60 el.each(function(){ 61 62 el.css('opacity', '100'); 63 64 var scrollTop = $(window).scrollTop(); 65 var obj = $(this); 66 var offset = obj.offset(); 67 var top = offset.top; 68 var distance = (top - scrollTop); 69 70 if( distance < screen.availHeight-100 ){ 71 var incoming = $(this).data('animate'); 72 $(this).addClass('animated ' + incoming); 73 } 74 75 }); 76 77 }); 78 79 }; 80 81}( jQuery )); 82 83
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.