jQuery鼠标悬停内容动画切换效果


Posted in jQuery onApril 27, 2017

效果如下:

jQuery鼠标悬停内容动画切换效果

代码如下:

<!DOCTYPE html>
<html>

 <head>
 <meta http-equiv="content-type" content="text/html; charset=UTF-8">
 <title>jQuery鼠标悬停内容动画切换效果</title>
 <style>
  * {
  margin: 0;
  padding: 0;
  list-style: none;
  }

  img {
  border: 0;
  }

  a {
  color: #fff;
  text-decoration: none;
  }

  .servicesBox {
  width: 1000px;
  height: 270px;
  margin: 0 auto;
  clear: both;
  line-height: 18px;
  color: #999999;
  font-size: 12px;
  }

  .servicesBox .serBox {
  cursor: pointer;
  border: 1px solid #fff;
  display: inline;
  width: 198px;
  height: 250px;
  float: left;
  overflow: hidden;
  background-color: #f7f7f7;
  position: relative;
  }

  .servicesBox .serBoxOn {
  font-family: "Microsoft Yahei";
  display: none;
  width: 320px;
  height: 270px;
  background: url(http://demo.lanrenzhijia.com/2014/pic0910/images/serboxon_bg.gif) repeat 0px 0px;
  position: absolute;
  left: 0px;
  top: 0px;
  z-index: 19;
  }

  .servicesBox .serBox .pic1 {
  width: 110px;
  height: 110px;
  text-align: center;
  position: absolute;
  top: 22px;
  right: 41px;
  z-index: 99;
  }

  .servicesBox .serBox .pic2 {
  width: 110px;
  height: 110px;
  text-align: center;
  position: absolute;
  top: 22px;
  left: -110px;
  z-index: 99;
  }

  .servicesBox .serBox .txt1 {
  width: 198px;
  height: 100px;
  color: #999999;
  position: absolute;
  top: 145px;
  left: 0px;
  z-index: 99;
  }

  .servicesBox .serBox .txt2 {
  width: 198px;
  height: 100px;
  color: #a9cf4f;
  position: absolute;
  top: 145px;
  right: -240px;
  z-index: 99;
  }

  .servicesBox .serBox span.tit {
  font-size: 16px;
  display: block;
  text-align: center;
  }

  .servicesBox .serBox .txt1 .tit {
  color: #000000;
  line-height: 30px;
  }

  .servicesBox .serBox .txt2 .tit {
  color: #fff;
  line-height: 30px;
  font-family: "Microsoft Yahei";
  }

  .servicesBox .serBox p {
  padding: 0 10px;
  text-align: center;
  }
 </style>
 </head>

 <body>
 <!-- 代码begin -->
 <div class="servicesBox">
  <div id="Div35" class="serBox" onclick="serFocus(1)">
  <div class="serBoxOn"></div>
  <div class="pic1 mypng"> <img src="http://demo.lanrenzhijia.com/2014/pic0910/images/3.png"> </div>
  <div class="pic2 mypng"> <img src="http://demo.lanrenzhijia.com/2014/pic0910/images/3-3.png"> </div>
  <div class="txt1"> <span class="tit">开心网</span>
   <p>开心网营销</p>
  </div>
  <div class="txt2">
   <a href="http://www.lanrenzhijia.com" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" target="_blank" class="a_jump"><span class="tit">开心网</span>
   <p>开心网营销</p>
   </a>
  </div>
  </div>
  <div id="Div36" class="serBox" onclick="serFocus(2)">
  <div class="serBoxOn"></div>
  <div class="pic1 mypng"> <img src="http://demo.lanrenzhijia.com/2014/pic0910/images/1.png"> </div>
  <div class="pic2 mypng"> <img src="http://demo.lanrenzhijia.com/2014/pic0910/images/1-1.png"> </div>
  <div class="txt1"> <span class="tit">人人网</span>
   <p>人人网营销</p>
  </div>
  <div class="txt2">
   <a href="http://www.lanrenzhijia.com" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" target="_blank" class="a_jump"><span class="tit">人人网</span>
   <p>人人网营销</p>
   </a>
  </div>
  </div>
  <div id="Div37" class="serBox" onclick="serFocus(3)">
  <div class="serBoxOn"></div>
  <div class="pic1 mypng"> <img src="http://demo.lanrenzhijia.com/2014/pic0910/images/2.png"> </div>
  <div class="pic2 mypng"> <img src="http://demo.lanrenzhijia.com/2014/pic0910/images/2-2.png"> </div>
  <div class="txt1"> <span class="tit">QQ空间</span>
   <p>QQ空间营销</p>
  </div>
  <div class="txt2">
   <a href="http://www.lanrenzhijia.com" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" target="_blank" class="a_jump"><span class="tit">QQ空间</span>
   <p>QQ空间营销</p>
   </a>
  </div>
  </div>
  <div id="Div38" class="serBox" onclick="serFocus(3)">
  <div class="serBoxOn"></div>
  <div class="pic1 mypng"> <img src="http://demo.lanrenzhijia.com/2014/pic0910/images/35.png"> </div>
  <div class="pic2 mypng"> <img src="http://demo.lanrenzhijia.com/2014/pic0910/images/35-35.png"> </div>
  <div class="txt1"> <span class="tit">问答营销</span>
   <p>问答投放 锁住潜在客户</p>
  </div>
  <div class="txt2">
   <a href="http://www.lanrenzhijia.com" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" target="_blank" class="a_jump"><span class="tit">问答营销</span>
   <p>问答投放 锁住潜在客户</p>
   </a>
  </div>
  </div>
  <div id="Div39" class="serBox" onclick="serFocus(3)">
  <div class="serBoxOn"></div>
  <div class="pic1 mypng"> <img src="http://demo.lanrenzhijia.com/2014/pic0910/images/31.png"> </div>
  <div class="pic2 mypng"> <img src="http://demo.lanrenzhijia.com/2014/pic0910/images/31-31.png"> </div>
  <div class="txt1"> <span class="tit">邮件推广</span>
   <p>低成本 商机无限</p>
  </div>
  <div class="txt2">
   <a href="http://www.lanrenzhijia.com" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" target="_blank" class="a_jump"><span class="tit">邮件推广</span>
   <p>低成本 商机无限</p>
   </a>
  </div>
  </div>
 </div>
 <script src="http://www.lanrenzhijia.com/ajaxjs/jquery.min.js"></script>
 <script>
  $(function() {
  $(".serBox").hover(
   function() {
   $(this).children().stop(false, true);
   $(this).children(".serBoxOn").fadeIn("slow");
   $(this).children(".pic1").animate({
    right: -110
   }, 400);
   $(this).children(".pic2").animate({
    left: 41
   }, 400);
   $(this).children(".txt1").animate({
    left: -240
   }, 400);
   $(this).children(".txt2").animate({
    right: 0
   }, 400);
   },
   function() {
   $(this).children().stop(false, true);
   $(this).children(".serBoxOn").fadeOut("slow");
   $(this).children(".pic1").animate({
    right: 41
   }, 400);
   $(this).children(".pic2").animate({
    left: -110
   }, 400);
   $(this).children(".txt1").animate({
    left: 0
   }, 400);
   $(this).children(".txt2").animate({
    right: -240
   }, 400);
   }
  );
  });
 </script>
 <!-- 代码end -->
 </body>

</html>

以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,同时也希望多多支持三水点靠木

jQuery 相关文章推荐
jQuery序列化后的表单值转换成Json
Jun 16 jQuery
jQuery表单设置值的方法
Jun 30 jQuery
jQuery Datatable 多个查询条件自定义提交事件(推荐)
Aug 24 jQuery
jquery 给动态生成的标签绑定事件的几种方法总结
Feb 24 jQuery
关于jquery layui弹出层的使用方法
Apr 21 jQuery
通过jquery.cookie.js实现记住用户名、密码登录功能
Jun 20 jQuery
JQuery animate动画应用示例
May 14 jQuery
jQuery实现的鼠标拖动画矩形框示例【可兼容IE8】
May 17 jQuery
jQuery实现弹幕特效
Nov 29 jQuery
jquery实现垂直手风琴菜单
Mar 04 jQuery
JQuery复选框全选效果如何实现
May 08 jQuery
jQuery 实现DOM元素拖拽交换位置的实例代码
Jul 14 jQuery
使用jQuery,Angular实现登录界面验证码详解
Apr 27 #jQuery
jQuery实现鼠标滑过预览图片大图效果的方法
Apr 26 #jQuery
详谈jQuery中使用attr(), prop(), val()获取value的异同
Apr 25 #jQuery
jquery.form.js异步提交表单详解
Apr 25 #jQuery
关于jQuery中fade(),show()起始位置的一点小发现
Apr 25 #jQuery
jquery submit()不能提交表单的解决方法
Apr 24 #jQuery
jquery实现异步加载图片(懒加载图片一种方式)
Apr 24 #jQuery
You might like
php 注册时输入信息验证器的实现详解
2013/07/05 PHP
以文件形式缓存php变量的方法
2015/06/26 PHP
php数字运算验证码的实现代码
2015/07/30 PHP
详解YII关联查询
2016/01/10 PHP
Laravel重定向,a链接跳转,控制器跳转示例
2019/10/22 PHP
jquery里的each使用方法详解
2010/12/22 Javascript
整理的比较全的event对像在ie与firefox浏览器中的区别
2013/11/25 Javascript
jQuery检测某个元素是否存在代码分享
2015/07/09 Javascript
JS中的forEach、$.each、map方法推荐
2016/04/05 Javascript
Bootstrap导航条学习使用(二)
2017/02/08 Javascript
基于JavaScript实现滑动门效果
2017/03/16 Javascript
vue学习笔记之指令v-text &amp;&amp; v-html &amp;&amp; v-bind详解
2017/05/12 Javascript
vue 项目中使用Loading组件的示例代码
2018/08/31 Javascript
vue实现条件判断动态绑定样式的方法
2018/09/29 Javascript
详解基于vue-cli3.0如何构建功能完善的前端架子
2018/10/09 Javascript
redux处理异步action解决方案
2020/03/22 Javascript
[00:53]2015国际邀请赛 中国区预选赛一触即发
2015/05/14 DOTA
浅谈DataFrame和SparkSql取值误区
2018/06/09 Python
python进阶之多线程对同一个全局变量的处理方法
2018/11/09 Python
详解django2中关于时间处理策略
2019/03/06 Python
django 实现简单的插入视频
2020/04/07 Python
pyspark 随机森林的实现
2020/04/24 Python
python中用ctypes模拟点击的实例讲解
2020/11/26 Python
python 基于opencv 实现一个鼠标绘图小程序
2020/12/11 Python
神经网络训练采用gpu设置的方式
2021/03/03 Python
18岁生日感言
2014/01/12 职场文书
求职信模板怎么做
2014/01/26 职场文书
趣味比赛活动方案
2014/02/15 职场文书
《姥姥的剪纸》教学反思
2014/02/25 职场文书
医师定期考核实施方案
2014/05/07 职场文书
2014第二批党的群众路线教育实践活动对照检查材料思想汇报
2014/09/18 职场文书
抢劫罪辩护词
2015/05/21 职场文书
挂职锻炼工作总结2015
2015/05/28 职场文书
百年校庆感言
2015/08/01 职场文书
诉讼和解协议书
2016/03/23 职场文书
MySQL 8.0 驱动与阿里druid版本兼容问题解决
2021/07/01 MySQL