delegate绑定多个事件用法
比如:
<div class="div">123</div>
JS部分:
$(document).delegate(".div","mouseenter mouseleave",function(e){ var type = e.type; if(type == "mouseenter"){ $(this).css("color","#ee1313"); }else{ $(this).css("color","#ddd"); } })
显示效果为,鼠标移入显示红色(#ee1313);
移出显示为灰色(#ddd)