首页 > 代码库 > ie8下$(document).on('mouseover mouseout','ul li',function(){})的bug

ie8下$(document).on('mouseover mouseout','ul li',function(){})的bug

$(document).on(‘mouseover mouseout‘,‘ul li‘,function(){

  if (event.type == ‘mouseover‘) {
           console.log($(this));
      }else if(event.type == ‘mouseout‘){
           console.log($(this));
      }

});

上述代码在IE8下会console多个结果,在代码末端添加return false可解决问题;

ie8下$(document).on('mouseover mouseout','ul li',function(){})的bug