Access our premium support and let us know your problems, we will help you solve them.

0
No products in the cart.

Forum Replies Created

Viewing 1 post (of 1 total)
  • Author
    Posts
  • in reply to: Slider with vertical parallax effect #9302
    blankchuck-le-butt
    Participant

    Here’s how I solved it:

    I added transform: translate3d(0,0,0) to the slider element, and then modified it as the user scrolls down (eg. transform: translate3d(0,10px,0)). A simple, clean solution:

    $(window).scroll(function() {
        if($(window).scrollTop() > 0) {
    
            var parallaxDistance = ($(window).scrollTop()/2), 
                parallaxCSS = "translate3d(0, "+ parallaxDistance +"px , 0)";
    
            $('.slides').css('transform', parallaxCSS);
    
        } else {
    
            $('.slides').css('transform', 'translate3d(0, 0, 0)');
        }
    });
    
Viewing 1 post (of 1 total)