1(function($) { 2 3var Animate = function( element ){ 4 5 this.$element = $( element ); 6 7 this._bindEvents(); 8 this.scrollHandler(); 9 10} 11 12Animate.prototype._bindEvents = function(){ 13 14 $(window).on( 'scroll', EventUtils.throttle( this.scrollHandler.bind( this ), 200 ) ); 15 $(window).on( 'resize', EventUtils.debounce( this.scrollHandler.bind( this ), 150 ) ); 16} 17 18Animate.prototype.scrollHandler = function( event ){ 19 20 if( this.$element.offset().top <= $( window ).scrollTop() + window.innerHeight * 0.85 ){ 21 22 this.$element.addClass('animated'); 23 } 24 25} 26 27 28$.fn.btwAnimate = function(){ 29 30 var _ = this, 31 l = _.length, 32 i; 33 34 for( i = 0; i < l; i++ ){ 35 _[i].Animate = new Animate(_[i]); 36 } 37 38 return _; 39}; 40 41 42 43$( document ).ready( function(){ 44 $( '.animate' ).btwAnimate(); 45}); 46 47 48})(jQuery);
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.