I'm using backrground animation script like this:
$("body").bind('mousemove', function(e){
$('#people').css({backgroundPosition: (e.pageX / 15 ) + 'px ' + (e.pageY / 15 - 100 ) + 'px' });
$('#lady').css({backgroundPosition: (e.pageX / 10 ) + 'px ' + (e.pageY / 10 - 100 ) + 'px' });
$('#city').css({backgroundPosition: (e.pageX / 30 ) + 'px ' + (e.pageY / 30 - 100 ) + 'px' });
});
everything works fine, except the performance... it's going really laggy, especialy in opera, chrome and FF... in IE, everything works very smooth. Did anybody know, how to get better performance of this little script?
You can check the effect here: http://VisualStory.pl/test
I've change a code a little, to use 3D transform, and performance is much, much better, now the code look like this: var img3 = $('#lady'); var img2 = $('.img2'); var img1 = $('.img1'); var overlay = $('#particles');