我建议在jQuery上使用CSS(如果可能),否则可以使用类似的东西
$("div.myclass").hover(function() { $(this).css("background-color","red")});您可以根据需要更改选择器。
正如@ A.Wolff所评论的那样,如果要将悬停效果用于多个类,则可以像这样使用它
$(".myclass, .myclass2").hover(function(e) { $(this).css("background-color",e.type === "mouseenter"?"red":"transparent") })


