当前位置:编程学习 > JS >>

关于jQuery中对hover事件unbind

今天遇到了这个问题,最开始以为直接unbind(“hover”)就可以搞定,失败。网上搜了好多都不是很正确,最后还是在一个老外的博客上看到了正确的方法,现在拿出来共享,原文地址http://harrybailey.com/2008/11/jquery-hover-and-unbinding/

网上所说的取消hover事件有以下几种方式:

/* 这种方式是错误的 */
$(#hover_div).unbind(hover);

/* 这种方式也是错误的 */
$(#hover_div).unbind(mouseover).unbind(mouseout);

/* 这种方式是新增的,在老的版本里是无法使用的 */
$(#hover_div).unbind(mouseenter mouseleave);

/* 正确的,新老版本都可用 */
$(#hover_div).unbind(mouseenter).unbind(mouseleave);

补充:Web开发 , Jsp ,
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,