Ad

How Do You Move Text To The Left When Scrolling?

- 1 answer

I'am making a shopify store, and I wanted a similar effect to https://www.carbonbeauty.com/. I have never used css before but I want to know how they move the text to the left when you start to scroll.

Ad

Answer

Use something like this, where you target the element that has the text you want to move, and you can make wScroll either positive or negative to move it left or right:

enter code here



$(document).ready(function () {
    $(window).scroll(function () {
        var wScroll = $(this).scrollTop();

        //parallax for the main title

        $('element you want to move').css({
            'transform' : 'translateX('wScroll+'px)'
        });
    });
});
Ad
source: stackoverflow.com
Ad