滚动页面的 jQuery 事件是什么?
What's the jQuery event for scrolling the page?
我想在用户使用鼠标滚轮或滚动条滚动页面时删除 class focus-mode
:
$("#input-content").on("SCROLLING_EVENT", function(e) {
$(".chapter-form").toggleClass("focus-mode");
});
但我在网上找不到任何相关信息。 jQuery 是否有滚动事件?如果没有,什么是最好的实现我想要的?
$(window).scroll(function(){
$(".chapter-form").toggleClass("focus-mode");
});
每次滚动时都会触发此代码。
使用scroll event喜欢,
$(function(){
$('#input-content').scroll(function(e) {
$(".chapter-form").toggleClass("focus-mode");
});
});
很普通 "scroll"
。
.on( "scroll", handler )
This method is a shortcut for .on( "scroll", handler ) in the first
and second variations, and .trigger( "scroll" ) in the third.
我想在用户使用鼠标滚轮或滚动条滚动页面时删除 class focus-mode
:
$("#input-content").on("SCROLLING_EVENT", function(e) {
$(".chapter-form").toggleClass("focus-mode");
});
但我在网上找不到任何相关信息。 jQuery 是否有滚动事件?如果没有,什么是最好的实现我想要的?
$(window).scroll(function(){
$(".chapter-form").toggleClass("focus-mode");
});
每次滚动时都会触发此代码。
使用scroll event喜欢,
$(function(){
$('#input-content').scroll(function(e) {
$(".chapter-form").toggleClass("focus-mode");
});
});
很普通 "scroll"
。
.on( "scroll", handler )
This method is a shortcut for .on( "scroll", handler ) in the first and second variations, and .trigger( "scroll" ) in the third.