在我们的页面中经常会用到mouseover与mouseout事件来给页面添加更好的渲染效果,但如果触发mouseover事件的元素有子元素的话,会造成闪烁的效果,看着很不舒服,这是因为mouseover与mouseout不论鼠标指针穿过被选元素或其子元素,都会触发。而mouseenter与mouseleave只有在鼠标指针穿过被选元素时,才会触发 mouseenter 事件。

 <ul class="con-ul">
<li>
<div class="con-one">
<div class="con-oneimg">
<img src="http://image123465.cn">
<div class="dask" style="display: block; opacity: 0;"></div>
<div class="input" style="display: block; opacity: 0;">
<input type="button" class="inp inp-one" value="预览">
<input type="button" class="inp inp-two" value="使用">
</div>
</div>
<hr style="border-top:1px solid #b5b5b5;">
<p>study</p>
</div>
</li>
</ul>
 //
$(".con-ul").on({
mouseenter: function() {
$(this).find(".dask").stop(true,true).fadeIn(600);
$(this).find(".input").stop(true,true).fadeIn(600);
},
mouseleave: function() {
$(this).find(".dask").stop(true,true).fadeOut(300);
$(this).find(".input").stop(true,true).fadeOut(300);
}
}, ".con-oneimg"); //
$(".con-ul").on({
mouseover: function() {
$(this).find(".dask").stop(true,true).fadeIn(600);
$(this).find(".input").stop(true,true).fadeIn(600);
},
mouseout: function() {
$(this).find(".dask").stop(true,true).fadeOut(300);
$(this).find(".input").stop(true,true).fadeOut(300);
}
}, ".con-oneimg");

最新文章

  1. JavaScript操作Cookie
  2. js鼠标滚轮滚动图片切换效果
  3. [Architecture Pattern] Factory Builder
  4. 使用inno setup打包程序完整脚本(.net框架检测,重复安装检测)
  5. discuz X2.5自己写代码,获取当前登录的用户信息
  6. 【转】Enable ARC in a Cocos2D Project: The Step-by-Step-How-To-Guide Woof-Woof!
  7. SQL server概述
  8. 使用libcurl提交POST请求
  9. iOS特性
  10. linux下使用gcc编译运行C程序
  11. Mybatis Generator生成Mybatis Dao接口层*Mapper.xml以及对应实体类
  12. SVN的安装和配置
  13. Flask 学习 七 用户认证
  14. python接口自动化-post请求2
  15. php单例模式的实例
  16. 【BZOJ1930】【SHOI2003】吃豆豆
  17. bash脚本:集群资源争夺战crazy-killer
  18. 理解JVM——JVM的结构
  19. SP_attach_db 添加数据库文件
  20. python3 requests 进行接口测试、爬虫使用总结

热门文章

  1. WPF使用RoutedCommand自定义命令
  2. Sencha Touch xtype对应的class
  3. SQL注入测试用例
  4. 《JavaScript DOM编程艺术》
  5. CSS 外边距(margin)重叠及防止方法
  6. CodeIgniter API
  7. WCF分布式开发步步为赢(3)WCF服务元数据交换、配置及编程开发
  8. (2)jni编程学习笔记
  9. js&amp;html5实现消星星游戏
  10. select into from和insert into select from两种表复制语句区别