0

Example of what I'm looking for here: https://www.98point6.com/

Is there a clean javascript solution that works? I haven't been able to implement the code I've founds so far.

Adam.V
  • 779
  • 2
  • 9
  • 25
  • 1
    That kind of effect is called `parallax`, and there are many solutions available on [Github](https://github.com/search?l=JavaScript&langOverride=&q=parallax&repo=&start_value=1&type=Repositories). – Bill Oct 23 '17 at 02:33
  • [css-make-a-background-image-scroll-slower-than-everything-else](https://stackoverflow.com/questions/29240028/css-make-a-background-image-scroll-slower-than-everything-else) – Shadow Fiend Oct 23 '17 at 02:34

1 Answers1

0

try this. wscroll captures the scroll event position, and we can use that divided by something passed to the css translate property to scroll something at a slower speed.

$(document).ready(function () {
$(window).scroll(function () {
    var wScroll = $(this).scrollTop();
    $(elementyouwanttoscrollslower).css({
       'transform': 'translate(0px, '+ (wScroll/2)+'px)'
    });

} }

Marco Principio
  • 475
  • 3
  • 9