Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何检测用户是否将杆滚动了一定距离?
我想在用户将栏降低 1000 像素时触发一个事件。谢谢。
使用scroll事件结合scrollTop函数:
scroll
scrollTop
//when scrolling... $(window).scroll(function() { //if I scroll more than 1000px... if($(window).scrollTop() > 1000){ //do whatever } });
现场演示:http: //jsfiddle.net/NvfBc/