I have a small problem. I'm trying to do something like nikebetterworld.com's parallax background. In my first attemp, I got something that works, but it can work better. When I scroll, the background position changes. The problem is that it changes a few milliseconds after the scroll, so I can see how the background "jumps" after scrolling.
code:
var $w = $(window);
function move($c) {
var scroll = $w.scrollTop();
var diff = $c.offset().top - scroll;
var pos = '50% ' + (-diff)*0.5 + 'px';
$c.css({'backgroundPosition':pos});
}
$w.bind('scroll', function(e){
move(some_container);
});
Any suggestions? Thanks.
Edit
Look at this example: http://jsfiddle.net/MZGHq/ (Scroll down until you see the background image)