直接修改
$(".m2").mouseover(function(){
// $(this).css("background","white");
// $(this).css("box-sizing","border-box");
// $(this).css("border-style","solid");
// $(this).css("border-width","2px");
// $(this).css("border-color","rgb(204,0,0)");
$(this).css({
"background":"white",
"box-sizing":"border-box",
// "border-style":"solid",
// "border-width":"2px",
// "border-color":"rgb(204,0,0)"
"border":"2px solid rgb(204,0,0)"
});
});
$(".m2").mouseout(function(){
$(this).css({
"background":"",
"border":""
});
});
通过addClass修改
css
.addc1{
background: white;
box-sizing: border-box;
border:2px solid rgb(204,0,0);
}
jquery
$(".m2").mouseover(function(){
$(this).addClass("addc1");
});
$(".m2").mouseout(function(){
$(this).removeClass("addc1");
});
效果图
鼠标滑入
鼠标滑出