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制作input提示内容(兼容IE8以上)
Jul 05 jQuery
JQuery判断正整数整理小结
Aug 21 jQuery
zTree jQuery 树插件的使用(实例讲解)
Sep 25 jQuery
jquery实现左右轮播图效果
Sep 28 jQuery
jQuery实现的鼠标滚轮控制图片缩放功能实例
Oct 14 jQuery
jQuery实现碰到边缘反弹的动画效果
Feb 24 jQuery
jQuery实现常见的隐藏与展示列表效果示例
Jun 04 jQuery
jquery3和layui冲突导致使用layui.layer.full弹出全屏iframe窗口时高度152px问题
May 12 jQuery
jquery实现动态创建form并提交的方法示例
May 27 jQuery
jquery实现商品sku多属性选择功能(商品详情页)
Dec 20 jQuery
jquery+css3实现的经典弹出层效果示例
May 16 jQuery
jQuery编写QQ简易聊天框
Aug 27 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里得到前天和昨天的日期的代码
2007/08/16 PHP
php发送html格式文本邮件的方法
2015/06/10 PHP
PHP基于Redis消息队列实现发布微博的方法
2017/05/03 PHP
Javascript 面向对象 命名空间
2010/05/13 Javascript
基于jquery实现一张图片点击鼠标放大再点缩小
2013/09/29 Javascript
javascript 回到顶部效果的实现代码
2014/02/17 Javascript
JS实现弹性漂浮效果的广告代码
2015/09/02 Javascript
js实现的鼠标滚轮滚动切换页面效果(类似360默认页面滚动切换效果)
2016/01/27 Javascript
老生常谈onBlur事件与onfocus事件(js)
2016/07/09 Javascript
基于JS如何实现给字符加千分符(65,541,694,158)
2016/08/03 Javascript
JS查找字符串中出现次数最多的字符
2016/09/05 Javascript
谈谈对JavaScript原生拖放的深入理解
2016/09/20 Javascript
JavaScript reduce和reduceRight详解
2016/10/24 Javascript
js实现弹窗暗层效果
2017/01/16 Javascript
js for循环倒序输出数组元素的实例
2017/03/01 Javascript
js实现本地时间同步功能
2017/08/26 Javascript
JS实现基于拖拽改变物体大小的方法
2018/01/23 Javascript
详解Angularjs 自定义指令中的数据绑定
2018/07/19 Javascript
vue mounted 调用两次的完美解决办法
2018/10/29 Javascript
[01:07]DOTA2次级职业联赛 - Fpb战队宣传片
2014/12/01 DOTA
python读文件逐行处理的示例代码分享
2013/12/27 Python
深入解读Python解析XML的几种方式
2016/02/16 Python
Python读取excel中的图片完美解决方法
2018/07/27 Python
Pytorch加载部分预训练模型的参数实例
2019/08/18 Python
基于Python实现剪切板实时监控方法解析
2019/09/11 Python
pytorch中nn.Conv1d的用法详解
2019/12/31 Python
你应该知道的Python3.6、3.7、3.8新特性小结
2020/05/12 Python
python将字典内容写入json文件的实例代码
2020/08/12 Python
创联软件面试题笔试题
2012/10/07 面试题
校园绿化美化方案
2014/06/08 职场文书
三提三创主题教育活动查摆整改措施
2014/10/25 职场文书
七年级地理教学计划
2015/01/22 职场文书
2015年公司后勤管理工作总结
2015/05/13 职场文书
孟佩杰观后感
2015/06/17 职场文书
员工担保书范本
2015/09/22 职场文书
常用的MongoDB查询语句的示例代码
2021/07/25 MongoDB