jQuery: Background-Position Animation Plugin

How to use:

$('#background').animate({backgroundPosition: '(10% 250px)'});

Due to some browser bugs (i.e. Firefox, you have to set your (initial) background-position inline:

<div style="background-position: 10px 20px"></div>

Offcurse you can achieve this with JavaScript (jQuery), too:

$('#background').css({backgroundPosition: '10px 20px'});

Example:

$('#background') .css({backgroundPosition: '-60px 0'}) // workaround for FF 2.0 bug .click(function(){ $(this) .animate({backgroundPosition: '(500px 150px)'}) .animate({backgroundPosition: '(-20px 250px)'}); });

Klick me

Download & Bugtracker

Licenses

Back to protofunc