Check out the link http://codepen.io/anon/pen/zGLZoR
I have a "floating div" that moves along with the page scroll, but I want it to start floating only after the user has scrolled down 200px. Currently, it starts moving as soon as the scrollbar is moved. How can I achieve this?
$(window).scroll(function(){
$("#div").stop().animate({"marginTop": ($(window).scrollTop()) + "px", "marginLeft":($(window).scrollLeft()) + "px"}, "slow" );
});
UPDATE:
It is important that the div returns to its original position when scrolling back up past the 200px mark at the top of the page.