jquery - 向下滚动时元素被删除(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 了解不多。
谢谢,
解决方案
推荐阅读
- java - 我不明白为什么这段代码有效(Codingbat Array2 tenRun)
- javascript - 使用 Window.open 从父级打开的 2 个同级窗口之间的通信
- reactjs - 如何在reactJS中路由确切的字符串
- assembly - 如何学习如何使用裸机代码闪烁 LED(例如 STM32)?
- python - 如何在 django 中将元组插入表(postgres)?
- python - 尝试打印时无输出
- r - R如何区分dplyr包中的两个过滤器函数和时间序列中的线性过滤器?
- node.js - 如何遍历 Postman 中的数组?
- sql - 错误:列“user1”不存在,在插入 postgres 表时发生
- typescript - 如何使用 TypeScript 将 express 标头作为字符串传递给函数?