I currently have this for images that move as they scroll around the screen (performed using jQuery), but I want them to stop at a specific point.
This is the code that I have at the moment.
$(document).ready(function() { var $bagSix = $("#six"); var $bagEight = $("#eight"); var $bagTen = $("#ten"); var $bagTwelve = $("#twelve"); $(window).scroll(function(){ $bagSix .stop() .animate({"marginTop": ($(window).scrollTop() + 30) + "px"}, "slow" ); }); $(window).scroll(function(){ $bagEight .stop() .animate({"marginTop": ($(window).scrollTop() + 30) + "px"}, "slow" ); }); $(window).scroll(function(){ $bagTen .stop() .animate({"marginTop": ($(window).scrollTop() + 30) + "px"}, "slow" ); }); $(window).scroll(function(){ $bagTwelve .stop() .animate({"marginTop": ($(window).scrollTop() + 30) + "px"}, "slow" ); }); });
source share