Search code examples
javascriptjquerywordpressscrollwindow

Window scroll function not working wordpress


We have been looking for a while now but still haven't found the solution to this matter.

We are designing the site in wordpress

URL: http://jouwdesign.be/fontanella/site/lunchmenu/

The golden menu (.submenu) has a script linked to it wich should add the class 'test' when scrolling vertically past 100 pixels. For some reason it wouldn't even display a classchange when inspecting in chrome or any other browser. We already tried to disable all custom js and plugins but no luck so far.

Here is the jQuery:

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

        if ($(window).scrollTop() >= 100) {
            $(".submenu").addClass("test");
        }
    });
});

Anyone who has experienced the same problem in wordpress or any other ways?

Thanks!


Solution

  • Found the solution. I had to remove 'height 100%' on my body tag in css All works fine now!