改变高光颜色

JQuery 高亮显示方法将高亮显示任何带有黄色背景的 div。

如何指定使用什么颜色而不是黄色来突出显示?

46114 次浏览

根据 文件:

$(this).effect("highlight", {color: 'blue'}, 3000);
$("div").click(function () {
$(this).effect("highlight", { color: "#ff0000" }, 3000);
});

会用红色突出显示,都在 文件里。

FWIW 我发现 IE8在 jQuery 1.7.2中使用 effect("highlight",...)会出错,当元素的当前颜色被指定为文本,或者当突出显示的颜色被指定为文本(即 "blue")而不是十六进制表示法: "#ff0000"

       $('.divID').live('mouseover mouseout', function (event) {
if (event.type == 'mouseover') {
// do something on mouseover
$(this).css({ "background-color": YOURCOLOR, "opacity": ".50" });


}
else {
// do something on mouseout
$(this).css("opacity", "100");


}
});

这将给不透明的外观漂亮的悬停效果。