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.
精彩评论