//hover事件
$("a").hover(function(event){
$(this).css("color", "red");
},function(event){
$(this).css("color", "blue");
});
正常hover事件在某些时候会有局限性,可以改编成这样
$(this).css("color", "red");
},function(event){
$(this).css("color", "blue");
});
正常hover事件在某些时候会有局限性,可以改编成这样
第一种:切换式
$(document).on(
'mouseenter mouseleave'
,
".tab_ul >.row"
,
function
() {
$(
this
).find(
"h3"
).toggleClass(
"zt_bh"
);
$(
this
).find(
".more"
).toggleClass(
"zt_bh1"
);
$(
this
).find(
".hx"
).stop().toggle().slow();
})
//data_center
$(document).on(
'mouseenter mouseleave'
,
".xz_down"
,
function
() {
$(
this
).toggleClass(
"xa_bs"
);
$(
this
).find(
".img1"
).toggle();
$(
this
).find(
".img2"
).toggle();
$(
this
).find(
"em"
).toggleClass(
"xa_bs"
);
})
第二种:隐藏显现式
$(
'ul.course_lists li'
).on({
mouseenter:
function
(){
$(
this
).css(
'border-color'
,
'#ccc'
);
},
mouseleave:
function
(){
$(
this
).css(
'border-color'
,
'#fff'
);
}
});
第三种:第一种的精确延伸
$(obj).on(
"mouseover mouseout"
,
function
(event){
if
(event.type ==
"mouseover"
){
//鼠标悬浮
}
else
if
(event.type ==
"mouseout"
){
//鼠标离开
}
})