1(function ($) { 2 $.fn.scrollparallax = function(options) { 3 var el = this; 4 var app = { 5 speed:10, 6 mode:1, 7 axis:"Y", 8 scale:1, 9 index:0, 10 delay:1.4, 11 blur:0, 12 mobile:false, 13 ready: function() { 14 var self = this; 15 this.isMobile = this.checkMobile(); 16 17 $(el).each(function(){ 18 var css = { 19 "will-change":"transform", 20 "transition":"all "+self.delay+"s cubic-bezier(.165,.84,.44,1)", 21 }; 22 if(self.blur) css["filter"] = "blur("+self.blur+"px)"; 23 $(this).css(css); 24 self.scrollparallax($(this)) 25 }); 26 $(window).scroll(function(){ 27 $(el).each(function(){ 28 self.scrollparallax($(this)) 29 }); 30 }); 31 }, 32 checkMobile:function() { 33 return ( $(window).width() <= 767 ); 34 }, 35 scrollparallax:function(el){ 36 var self = this; 37 var top = $(window).scrollTop(); 38 var bottom = top + $(window).height(); 39 var elTop = $(el).offset().top - 20; 40 var elBottom = elTop + $(el).height() + 40; 41 var botDif = bottom-elTop; 42 var topDif = elBottom-top; 43 var visible = (botDif>0 && topDif>0) ? 1 : 0; 44 var perc = (topDif-botDif)/$(window).height(); 45 if(visible) self.animate(perc); 46 return; 47 }, 48 animate: function(perc) { 49 if(this.isMobile && !this.mobile) { 50 $(el).attr("styles",""); 51 } else { 52 perc = (this.mode) ? perc : perc*-1; 53 n= perc*this.speed; 54 $(el).css({ 55 "z-index":this.index, 56 "transform": "scale("+this.scale+") translate"+this.axis+"("+n+"%)" 57 }); 58 } 59 } 60 } 61 if(!options) options = {}; 62 if(options.speed) app.speed = options.speed; 63 if(options.scale) app.scale = options.scale; 64 if(options.mode) app.mode = options.mode; 65 if(options.index) app.index = options.index; 66 if(options.mobile) app.mobile = options.mobile; 67 if(options.delay) app.delay = options.delay; 68 if(options.axis) app.axis = options.axis; 69 if(options.blur) app.blur = options.blur; 70 app.ready(); 71 }; 72}(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.