BTW, I have a quesiton: $(document).ready(function() { $('.buttons a') .mouseover(function() { var index = $('.buttons a').index(this); $(this).css({backgroundPosition: '-' + 200 * index + 'px -0'}) $(this).stop().animate({backgroundPosition:"(-" + 200 * index + "px -50px)"}, {duration: 600}) }) });
Is possible to execute the css() only once for each index? For example if Y-axis increased to -50px stop to execute the css() line again. Thanks! On Jul 11, 3:51 am, Karl Swedberg <k...@englishrules.com> wrote: > You could chain a .css() to it. Set the x axis first with .css() and > then the y axis with .animate() : > > $(this) > .css({backgroundPosition: '200px 0'}) > .animate({backgroundPosition:"(200px -50px)"}, {duration: 600}) > > --Karl > > ____________ > Karl Swedbergwww.englishrules.comwww.learningjquery.com > > On Jul 10, 2009, at 6:57 PM, yo2lux wrote: > > > > > Hi, > > The background position plugin by Alexander Farkas rocks!! > > But I have a question.. Is possible to remove the animation for the X- > > axis ? For example: > > > $(this).animate({backgroundPosition:"(200px -50px)"}, {duration: 600}) > > > I don't want to animate the X-axis. I don't need 1 2 3 4 .... 200px.. > > I want to achieve 200px without any incrementation. > > > On the other side I need the animation on Y-axis.. I want to increment > > to -50, something like -0 -1 -2 -3 -4 ..... etc... > > > I appreciate if someone try to help! Thanks!