I am trying to implement a scroll function that moves elements based on where the user scrolls, this code still works and it moves the elements.
The thing is, I want to have a list of different functions that move certain elements whenever you scroll past a specific div based on its id or class.
I thought that if I changed $("#pagelight2").scrollTop(), it would work, but it did not help
Any guidance would be appreciated.
thank
The updated code works, but it really is buggy every time I watch the animation, it stops moving - does anyone know a more efficient way to make this work?
var $scrollingDiv = $(".Page3-PeopleWalkingDown");
var p = $("#pagedark3");
var offset = p.offset();
var top = offset.top;
$(window).scroll(function() {
var scrollval = $(window).scrollTop() - top;
if ($(window).scrollTop() > 1400) {
$scrollingDiv
.stop()
.animate({
"left": "-" + (scrollval) + "px"
});
} else
{
$scrollingDiv
.stop()
.animate({
"left": +(0) + "px"
});
}