jquery元素绑定hover事件,判断鼠标移动进入和移除效果

2018-11-2817:38:52WEB前端开发Comments1,974 views字数 360阅读模式

jquery给元素绑定hover事件,在event事件中判断 鼠标移动进入和移除的效果!代码是:文章源自菜鸟学院-https://www.cainiaoxueyuan.com/gcs/8154.html

1
2
3
4
5
6
7
8
9
$("#user-home-menu").live("hover",function(event){
        if(event.type=='mouseenter'){ 
            $(this).find("span").addClass("hover");
            $(this).find("div").show();
        }else
            $(this).find("span").removeClass("hover");
            $(this).find("div").hide();
        }
    });

 文章源自菜鸟学院-https://www.cainiaoxueyuan.com/gcs/8154.html

 文章源自菜鸟学院-https://www.cainiaoxueyuan.com/gcs/8154.html

  • 本站内容整理自互联网,仅提供信息存储空间服务,以方便学习之用。如对文章、图片、字体等版权有疑问,请在下方留言,管理员看到后,将第一时间进行处理。
  • 转载请务必保留本文链接:https://www.cainiaoxueyuan.com/gcs/8154.html

Comment

匿名网友 填写信息

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定