什么我不能使backgroundPosition动画超过jque

什么我不能使backgroundPosition动画超过jque

本文介绍了为什么我不能使backgroundPosition动画超过jquery 1.4.4?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看到 jquery 1.5.0中缺少 backgroundPosition 动画是一个已知错误。它还没有修好吗?

I see here that the lack of backgroundPosition animation in jquery 1.5.0 is a known bug. Has it still not been fixed?

请参阅此,在jquery 1.4.4中使用 backgroundPosition 动画,然后查看,并且看到它甚至在jquery 1.7.1中都不起作用。

See this jsfiddle, with backgroundPosition animating in jquery 1.4.4, and then look at this one, and see that it isn't working even in jquery 1.7.1.

任何想法,当他们'重新解决这个问题?

Any idea when they're going to fix this?

我很想知道,因为我刚在Chrome控制台中看到一条警告说:

I'm wondering because I just saw a warning in my Chrome console saying this:

我担心我会继续使用jquery 1.4.4进行动画制作功能,但Chrome会在下次更新中提取功能。

I'm worried that I'm going to continue to use jquery 1.4.4 for the animating functionality, but then Chrome will pull the functionality in the next update.

接受的答案是,使用background-position-x和y的想法不适用于Firefox。现在我将不得不回到1.4.4,直到找到更好的解决方案。

The accepted answer, the idea to use background-position-x and y doesn't work with Firefox. For now I'm going to have to go back to 1.4.4, until I find a better solution.

推荐答案

你需要分别指定 background-position-x -y

$('div').animate({
  'background-position-x': '-6000px', 'background-position-y': '-200px' }, 4000);

(jQuery 1.7.1)

Working example. (jQuery 1.7.1)

作为旁注,因为你的 background-position-y 没有变化,您可以简单地省略额外的行,只需更改 -x

As a side note, since your background-position-y isn't changing, you can simply omit that extra line and just change your -x.

这篇关于为什么我不能使backgroundPosition动画超过jquery 1.4.4?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-06 05:05