Basically, I currently have a div that remains fixed and follows the user when they scroll until they reach a certain point. I can easily stop it at a fixed pixel position, as I did in the example below, but since I'm a jQuery idiot, I have no idea how to make it stop on a div instead.
Here is what I have used so far:
var windw = this;
$.fn.followTo = function ( pos ) {
var $this = this,
$window = $(windw);
$window.scroll(function(e){
if ($window.scrollTop() > pos) {
$this.css({
position: 'absolute',
top: pos
});
} else {
$this.css({
position: 'fixed',
top: 0
});
}
});
};
$('#one').followTo(400);
Here is an example: jsFiddle
, , , div, , , , div . . - , , ? , div , ? , .
.