Skip to content

Instantly share code, notes, and snippets.

@agragregra
Last active September 20, 2022 19:23
Show Gist options
  • Save agragregra/893f46449625f1156e78 to your computer and use it in GitHub Desktop.
Save agragregra/893f46449625f1156e78 to your computer and use it in GitHub Desktop.
Smooth Parallax Scroll
$(window).scroll(function() {
var st = $(this).scrollTop() /10;
$(".object").css({
"transform" : "translate3d(0px, " + st + "%, .01px)",
"-webkit-transform" : "translate3d(0px, " + st + "%, .01px)"
});
});
@WebKieth
Copy link

WebKieth commented Apr 15, 2018

@sealucky7 @agragregra аппаратец не при чём. нет requestAnimationFrame и как минимум надо округлять получаемый st до toFixed(2)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment