Webkit背景上的Jquery.animate()

亚历山大大帝

如何在$(this)上使用Jquery方法.animate()进行以下操作:

background: -webkit-gradient(linear, left top, left bottom, from(#2d2d2d), to(#373737))

我尝试使用:

$(this).css("background", "-webkit-gradient(linear, left top, left bottom, from(#d70000), to(#679938))");

哪个工作正常,但我想定义过渡所需的时间

亚历山大大帝
@-webkit-keyframes changeBG {
    0% {
        background: -webkit-gradient(linear, left top, left bottom, from(#2d2d2d), to(#373737));
}
50% {
    background: -webkit-gradient(linear, left top, left bottom, from(#666), to(#737373));
}
100% {
    background: -webkit-gradient(linear, left top, left bottom, from(#2d2d2d), to(#373737));
}

我使用-webkit-keyframes和类更改了200ms的时间来解决了这个问题。如果有人有想法,如何直接将-webkit-keyframes包含在Jquery中,而无需转移类,请写下您的答案。另外,对于.animate()为什么不起作用,我一无所知。如果有人能回答我,我将很感激

$(this).addClass('akt');
        setTimeout(function () { $(this).removeClass('akt'); }, 200);

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

jQuery .animate()和.done()

来自分类Dev

jquery问题与mouseenter()+ animate()

来自分类Dev

jquery:$()。animate()不是函数

来自分类Dev

jQuery .animate意外动作

来自分类Dev

滚动时的jquery .animate()

来自分类Dev

jQuery animate()divs打开

来自分类Dev

jQuery .animate离开页面

来自分类Dev

jQuery反转.animate并触发?

来自分类Dev

jQuery animate()更改文本

来自分类Dev

jQuery Animate动态转换

来自分类Dev

jQuery-在.css上使用.animate

来自分类Dev

鼠标滚轮绑定上的jQuery animate()

来自分类Dev

jQuery-在.css上使用.animate

来自分类Dev

悬停导航菜单上的jQuery animate()

来自分类Dev

在keydown()上平滑div的animate()

来自分类Dev

悬停时的jQuery Animate高度

来自分类Dev

jQuery-animate()无法停止?

来自分类Dev

jQuery .animate()无法正常工作

来自分类Dev

Firefox中的jQuery animate()Buggy

来自分类Dev

jQuery .animate()不起作用

来自分类Dev

通过animate()JQUERY获得进度

来自分类Dev

jQuery animate()使用keydown平滑

来自分类Dev

jQuery .animate()导致跳动输入

来自分类Dev

jQuery .animate无法正常工作

来自分类Dev

jQuery .slideUp在.animate之前执行

来自分类Dev

.animate jQuery无法正常工作

来自分类Dev

jQuery .animate()无法正常工作

来自分类Dev

CSS定位和jQuery .animate

来自分类Dev

Firefox中的jQuery animate()Buggy