Stop animate when reached bottom?

jquery

#1

Hi I got this code:

I am a newbie in all this.

$().ready(function() {  
   
var div = $("#bp-content-right-sidebar").height();
var win = $(window).height();

if (div < win ) {
		
 var $scrollingDiv = $("#bp-content-right-sidebar");
		$(window).scroll(function(){			
			$scrollingDiv
				.stop()
				.animate({"marginTop": ($(window).scrollTop() + -10) + "px"}, "fast" );			
		});
  }
	});

Can't figure out how to stop executing it when 200px from bottom and screen width is above 500px.

The trick is how to maintain all these variables upon windows resizing?

In other words if I load page with width of 1000px and then resize it to 200px it needs to comply and not run since I have specified only to run above 500px.


#2

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.