jquery animate background position

jimbo picture jimbo · Mar 2, 2011 · Viewed 137.7k times · Source

I can't seem to get this working.

$('#product_family_options_dd').animate({
  height: '300px',
  width: '900px',
  backgroundPosition: '-20px 0px',          
},

The height and width animate but not the background.

Answer

nnyby picture nnyby · Oct 8, 2011

You don't need to use the background animate plugin if you just use separate values like this:

$('.pop').animate({
  'background-position-x': '10%',
  'background-position-y': '20%'
}, 10000, 'linear');