首页 > 解决方案 > 向下滚动时元素被删除(Jquery)

问题描述

这是我的jQuery。

var count = 0;
    $(window).scroll(function(event){       

        var scrolled = $(this).scrollTop();     

        if (scrolled > count){  
            //scroll down
            count++;
            $('#nav-wrap').addClass('active');      
        }


        else {          
            //scroll up
            count--; 
            $('#nav-wrap').removeClass('active');
        }           
    });

当我向下滚动类似 fb 的按钮时,它会被删除。我不知道是什么影响了它,因为我对 Jquery 了解不多。

谢谢,

标签: jquery

解决方案


推荐阅读