简体   繁体   English

如何检查使用jQuery滚动了多少元素?

[英]How can I check how much an element was scrolled using jQuery?

Google Reader and Gmail have scrollable divs that has a shadow on top if the div was scrolled. Google Reader和Gmail具有可滚动的div,如果div滚动,则该div的顶部带有阴影。 The shadow changes opacity depending on how much the div was scrolled. 阴影会更改不透明度,具体取决于div滚动了多少。 How can I check how much an element was scrolled using Javascript/jQuery? 如何检查使用Javascript / jQuery滚动了多少元素?

Use $(el).scrollTop() to find how many pixels from the top an element (including, say, body ) has been scrolled. 使用$(el).scrollTop()查找元素(包括body )从顶部滚动了多少像素。

As @nathanjosiah suggests, check the docs for details. 如@nathanjosiah所建议,请检查文档以获取详细信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM