开发者

How can I get to know if an Element can be seen by the user with Google Closure?

I would like to write a java script that allows me to see the table headings of each column when a开发者_运维问答t least one column of the table is visible. So I want an "excel-like" effect, when the user scrolls down a big table.

So I have to be able to check if an element is at the screen of the user at the moment. When he scrolls down long enough, the element "disappears" from his screen. How do I check that?

The only function I found was goog.style.isElementShown, but thats not what I want. In jQuery it seems to be .scrollTop().


Try goog.style.getVisibleRectForElement.

If you look at jQuery source code, you will see that .scrollTop() just unify access to element/window scrollTop https://github.com/jquery/jquery/blob/master/src/offset.js#L264 For elements, you can just use scrollTop.

But scrollTop is probably not what you are looking for.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜