使用jQuery动画覆盖body标签的背景色

编程入门 行业动态 更新时间:2024-10-08 22:55:08
本文介绍了使用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

jsfiddle/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标签的背景色

本文发布于:2023-11-12 20:41:14,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1582484.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:背景色   标签   动画   jQuery   body

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!