Do something after scrolling certain distance from any point on the page
Hi all,
I have a fixed position navigation which opens from the side of my page. I want it to close when the user scrolls 300px in either direction from whatever position they are on the page. i.e. they could be at the top of the page or somewhere in the middle.
So if the nav is open and the user scrolls 300px (in either direction) a class is removed from the nav.
I've tried using the WayPoints plugin and scrollTop but these seem to reference elements which are at certain points of the page so it doesn't work how I want it.
Apologies for the lack of demo, it's a client site and I can't make it public.
Any suggestions?
Thanks!