滚动时如何将文本向左移动?

How do you move text to the left when scrolling?

我正在制作一个 shopify 商店,我想要与 https://www.carbonbeauty.com/ 类似的效果。我以前从未使用过 css,但我想知道当您开始滚动时,他们如何将文本向左移动。

使用类似这样的方法,将包含要移动的文本的元素作为目标,您可以使 wScroll 为正或负以将其向左或向右移动:

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)'
        });
    });
});