开发者

Toggle element based on viewport & scrolling

I'm trying to toggle an element based on the viewport and scrolling.

By using $(window).scroll(function().. I can fire an event when the user scrolls but 开发者_如何学Gohow do I check whether you're scrolled to the top in order to hide the element?


In IE the property is

document.body.scrollTop 

and in standards-based browsers the property is

window.pageYOffset

Test for a value of 0 to hide your element.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜