I have a section (#intro) with a background image that has horizontal movement on scroll.
$(window).bind("load resize scroll",function(e) {
var y = $(window).scrollTop();
$("#intro").filter(function() {
return $(this).offset().top < (y + $(window).height()) &&
$(this).offset().top + $(this).height() > y;
}).css('background-position', + parseInt(+y / 10) + '% 50%'); ));
What I would like to happen is the background position to move until 80% is met for the X position; at which point the number will not increase. I want the stopping point to be '80% 50%', but if a user scrolls back up it will count down again.
How can I achieve this?