I want to trigger when user scroll Down and change section.
I want to do sometlike this:
$(document).ready(function () {
/* *
/* SCROLL Event
/* */
$(window).scroll(function () {
        document.getElementById("navbar").style.background = "rgba(0, 0, 0, 0.2)";
        $(".logo a").css("color", "#ec008c");
        $(".box-shadow-menu").css("background-color", "#ec008c");
        $(".box-shadow-menu").css("box-shadow", "0 0.37em 0 0 #ec008c, 0 0.73em 0 0 #ec008c");
        console.log("Scroll")
    });
});
How can I do? If I use this code don't works, why?
Thank You, Gian Marco.
It's in the case of the window having no place to scroll right ?
I think you have to bind the mousewheel event.
   $(window).bind('mousewheel', function(e){
     if(e.originalEvent.wheelDelta /120 > 0) {
       console.log('scrolling up');
     }
     else{
       console.log('scrolling down');
     }
   });
But I think you might want to triger fullpage.js methode or Callbacks. You should probably triger your JS changing the color when you leave the first (or other) slide, exemple:
    $('#fullpage').fullpage({
    onLeave: function(index, nextIndex, direction){
        var leavingSection = $(this);
        //after leaving section 1
        if(index == 1 && direction =='down'){
            document.getElementById("navbar").style.background = "rgba(0, 0, 0, 0.2)";
            $(".logo a").css("color", "#ec008c");
            $(".box-shadow-menu").css("background-color", "#ec008c");
            $(".box-shadow-menu").css("box-shadow", "0 0.37em 0 0 #ec008c, 0 0.73em 0 0 #ec008c");       
        }          
    }
});
documentation on onLeave
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With