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: '20% 0'} ).click(function(){ $(this).animate({backgroundPosition: '(right 150px)'}, function(){ $(this).animate({backgroundPosition: '(10% 250px)'}); }); });

Klick me

Download & Bugtracker

Licenses

Back to protofunc