【发布时间】:2023-03-11 16:44:02
【问题描述】:
我遇到了一个示例,该示例应该在 JQuery 中的悬停事件上更改背景颜色。
(与.css("background-color","rgba(78, 175, 212, 0.75)");一致)
所有其他更改都在起作用,甚至是不透明度,但不是背景颜色,它总是为“rgb(0, 0, 0)”而变化。
此错误仅出现在 Chrome 上,而不出现在 IE 或 Mozilla(所有最新版本)上。
我指定 .over 类在处理之前没有属性 background-color 或 opacity。
这里是示例:
jQuery(document).on({
mouseenter: function(){
jQuery(".over, .overVideo",this).clearQueue()
.css("display", "block")
.css("height", "200px")
.animate({height:'350px'},{duration:200})
.css("opacity", "0.5")
.css("background-color","rgba(78, 175, 212, 0.75)");
jQuery(".blur, .blurVideo",this).clearQueue()
.css("height", "200px")
.animate({height: '350px'},{duration:200});
},
...
我试图移动背景色线,我试图设置另一种颜色,如“蓝色”、“#fff”或“rgb(12,12,12)”,但总是同样的问题.
你能帮帮我吗?
【问题讨论】:
标签: jquery css hover background-color mouseenter