jQuery使用.on()无法绑定hover

  发现好像没有hover这个事件,jQuery的hover事件是一个封装,hover算不得一个事件。他只是将mouseover和mouseout合并了
用mouseover和mouseout两个配合效果好像也是一样的。

下面教你用on方法,模拟hover方法。
$(obj).on("mouseover mouseout",function(event){
 if(event.type == "mouseover"){
  //鼠标悬浮
 }else if(event.type == "mouseout"){
  //鼠标离开
 }
})

 

posted @ 2017-01-06 10:47  front-gl  阅读(1630)  评论(0编辑  收藏  举报