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 how do I check whether you're scrolled to the top in order to hide the element?
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 how 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.