Question

I'm working on horizontal parallax. On my horizontal webpage, I have several div where I applied parallax effects on pictures. Actually, if I scroll with the horizontal scroll the parallax seems working. My problem, is when I click on the items menu the parallax seems not working. Do you know what I should modify ? Here is my fiddle : enter link description here

My javascript test :

    $(document).ready(function() {

       $("body").addClass("has-js");
        $("form").bind("submit",function(event){
           event.preventDefault();
        });
       $("#banner a").bind("click",function(event){
           event.preventDefault();
           var target = $(this).attr("href");
           $("html, body").stop().animate({
               scrollLeft: $(target).offset().left,
               scrollTop: $(target).offset().top
           }, 1200);
       });
    });

$(function(){
    /* main background image. moves against the direction of scroll*/
    $('.panel').scrollParallax({
        'speed': -0.2
    });

    /* inner items, moves slightly faster than the background */
    $('.panel .inner').scrollParallax({
        'speed': -0.5
    });

    /* two additional samples inside item2, both moving with direction of scroll*/
    $('.panel .inner-lev1').scrollParallax({
        'speed': 0.2
    }); 
    $('.panel .inner-lev2').scrollParallax({
        'speed': 0.5
    });
});

$("#banner a").bind("click",function(event){
           event.preventDefault();
           var target = $(this).attr("href");
$('.panel .inner-lev1').scrollParallax({
        'speed': 0.2
    });            
       });
Was it helpful?

Solution

You need to set a z-index on the navigation.

Something like this:

#banner {z-index: 10}

should do the trick.

Good luck!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top