Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // parallax
- $(function(){"use strict";function b(){var b=$(this).outerHeight(),c=b/2,d=a/2,e=$(this).offset().top,f=$(window).scrollTop(),g=$(this).attr("data-parallax-speed"),h=e-a,i=e+b,j=e-a,k=c+e-(d+d/2);h<0&&(h=0,i=a);var l=(f-h)/(i-h);l*=100,l*=g,l=l.toFixed(2);var m=(f-j)/(k-j);m=m.toFixed(2),m>=1&&(m=1),$(this).css("background-position","center "+l+"%")}var a=$(window).height();$(".parallax").each(b),$(window).on("scroll",function(a){$(".parallax").each(b)})});
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement