推翻对于javascript/jQuery for animate()很重要
我想为background-position-x设置动画,但它有一个推翻对于javascript/jQuery for animate()很重要,javascript,jquery,css,Javascript,Jquery,Css,我想为background-position-x设置动画,但它有一个背景位置:0!重要的在css中,我无法删除它。有没有办法用javascript解决这个问题?我看到我的jQuery代码正在做它的工作,只是css值正在覆盖它 我在谷歌上搜索过,但似乎无法添加!重要信息我的动画功能 //编辑。或者,如果我能用纯css实现这一点,那就更好了 谢谢 jQuery(document).ready(function($) { $('.section').animate({ 'backgroun
背景位置:0!重要的代码>在css中,我无法删除它。有没有办法用javascript解决这个问题?我看到我的jQuery代码正在做它的工作,只是css值正在覆盖它
我在谷歌上搜索过,但似乎无法添加!重要信息
我的动画功能
//编辑。或者,如果我能用纯css实现这一点,那就更好了
谢谢
jQuery(document).ready(function($) {
$('.section').animate({
'background-position-x': '100%'
}, 100000, 'linear');
});
//编辑2。这实际上似乎是可行的:
@-webkit-keyframes animatedBackground {
from {
background-position: 0px 0px; }
to {
background-position: 100% 0px; }
}
.section {
-webkit-animation: animatedBackground 200s linear infinite;
-moz-animation: animatedBackground 200s linear infinite;
animation: animatedBackground 200s linear infinite;
}
//编辑3。实际上,看起来FF仍然覆盖了!重要和补充!重要信息:关键帧块内部没有任何效果。思想?谢谢 这最终对我有效。我还加了50%让它反弹
@-webkit-keyframes animatedBackground {
from {
background-position: 0px 0px; }
50% {
background-position: 100% 0px; }
to {
background-position: 0px 0px; }
}
.section {
-webkit-animation: animatedBackground 200s ease infinite;
-moz-animation: animatedBackground 200s ease infinite;
animation: animatedBackground 200s ease infinite;
}
您可以使用CSS和转换来完成此操作-然后您可以应用一个类来实现转换。如果您有一个有效的答案,它可以回答您自己的问题。实际上,FF似乎仍然使用覆盖!重要信息
和添加!重要信息
关键帧块内部没有任何效果。思想?谢谢思想?谢谢@两天内逃逸是的!不过,我在上面加了一条评论。还有一些事情需要解决!