使用jQuery动画覆盖body标签的背景色 [英] Overriding background color of the body tag using jQuery animation

查看:64
本文介绍了使用jQuery动画覆盖body标签的背景色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用jQuery设置body标记的背景动画:

I try to animate the background of the body tag using jQuery:

因此,我添加了jQuery And jQuery UI CDN和以下代码:

So I've added the jQuery And jQuery UI CDNs and the code below:

$("body").animate({ backgroundColor: '#32a852' }, 1500);

该代码在JSFiddle中运行良好,但是当我尝试在自己的代码中使用它时,没有任何改变!

The code works fine in JSFiddle But when I try to use it in my own code nothing changes!

这是我的身体标签:

<body style="background: rgb(253, 253, 253);" class="cs-HTML is-theme-classic is-desktop" role="application"></body>

我认为上述body标签中的背景色可能会导致问题,也许我们需要以某种方式覆盖它...

I think maybe the background color in the above body tag causes the problem and maybe we need to override this in some way...

我很困惑,请帮助...

I'm confused please help...

推荐答案

我添加了一个jsfiddle,您应该将您的样式带到CSS上,然后重试,并且您应该确保主体是完整的高度和宽度,并且没有覆盖div已满身体上

I added one jsfiddle u should take yout style to css and try again and u should be sure that body is full height and width and there is no override div full on body

https://jsfiddle.net/9ycz5kus/2/

<body  class="cs-HTML is-theme-classic is-desktop" role="application"></body>

$("body").animate({backgroundColor: 'blue'},1500);

.cs-HTML {
  background: rgb(253, 253, 253);

}

这篇关于使用jQuery动画覆盖body标签的背景色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆