在鼠标悬停文本CRM时,会弹出一个弹出窗口。当我将鼠标悬停在文本上时,文本颜色应该改变 - 文本的颜色在悬停时应该变为红色。
我在下面提供了我的代码。
我把悬停属性给了我的班级,但它没有用。我该如何解决?
http://jsfiddle.net/a5tjG/3/embedded/result/
.cubeTextStyleCRM:hover {
color: red;
}
$('document').ready(function() {
window.setTimeout(function() {
$('.cubeCellCRM').each(function() {
var htmlText = $(this).attr('data-text');
$(this).append('<div class="cubeTextStyleCRM">' + htmlText + '</div>');
$(this).hover(
function() {
$(".cubeTextStyleCRM").append("<span class='divStock'>Customer Relationship Management</span>");
},
function() {
$(this).find("span:last").remove();
});
});
}, 600);
});
<div class="cubeCellCRM" data-text="CRM" data-caption="
<a style='padding-left: 40px; font-size: 14px; color: grey;' href='#' >Create</a> <div>
<a style='padding-left: 40px; font-size: 14px; color: grey;' href='#' >View/Edit</a> </div>
<a style='padding-left: 40px; font-size: 14px; color: grey;' href='#' >Reports</a>"
data-image="http://intra.defie.co/images/Desktop_icons_02.07.13/CRM.png"></div>
</div>
答案 0 :(得分:2)
您的CSS中的.cubeTextStyleCRM
有一个覆盖您颜色的color: #333 !important;
。只需将其保留为color: #333;
即可,:hover
应该有效。如果由于某种原因你无法到达CSS的那一部分,只需再次重写该规则,如:
<style>
.cubeTextStyleCRM {
color: #333;
}
.cubeTextStyleCRM:hover {
color: red;
}
</style>