首页 > web前端 > js教程 > 正文

jquery手风琴焦点动画

韦小宝
发布: 2017-11-21 10:28:32
原创
1851人浏览过

jquery手风琴焦点动画插件可以直接拿去用,对jquery有兴趣的同学也可以拿去研究,从而来升华我们的jquery知识。

QJZ]NC5NOQ5RYL93706)7}3.png

代码:

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>PHP中文网--手风琴焦点图</title>
<style>
  *{margin:0; padding:0;}
  body,html{width:100%; height:100%;}
  .bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
  }
  .bg-box-1{
    background: url('http://www.php.cn/tpl/Index/Static/img/zhibo4.jpg') no-repeat center/cover;
  }
  .bg-box-2{
    background: url('http://www.php.cn/tpl/Index/Static/img/banner1.jpg') no-repeat center/cover;
  }
  .bg-box-3{
    background: url('http://www.php.cn/tpl/Index/Static/img/banner3.jpg') no-repeat center/cover;
  }
  .bg-box-4{
    background: url('http://www.php.cn/tpl/Index/Static/img/banner4.jpg') no-repeat center/cover;
  }
  #wrap{
    position: absolute;
    overflow: hidden;
    top:0; left:0; right:0; bottom:0;
    margin:auto;
    width: 1000px;
    height: 400px;
  }
  #wrap > ul{
    width: 120%;
    list-style: none;
  }
  #wrap > ul > li{
    float: left;
    width: 100px;
    height: 400px;
    cursor: pointer;
  }
  #wrap > ul > li:nth-child(1){
    background: url('http://www.php.cn/tpl/Index/Static/img/zhibo4.jpg') no-repeat center/cover;
  }
  #wrap > ul > li:nth-child(2){
    background: url('http://www.php.cn/tpl/Index/Static/img/banner1.jpg') no-repeat center/cover;
  }
  #wrap > ul > li:nth-child(3){
    background: url('http://www.php.cn/tpl/Index/Static/img/banner3.jpg') no-repeat center/cover;
  }
  #wrap > ul > li:nth-child(4){
    background: url('http://www.php.cn/tpl/Index/Static/img/banner4.jpg') no-repeat center/cover;
    width: 700px;
  } 
  #wrap > ul > li > .text{
    width: 100px;
    height: 100%;
    background: #000;
    opacity: .5;
  }
  #wrap > ul > li > .text p{
    padding: 20px 40px;
    font-family: 'Microsoft yahei';
    color: #fff;
  }
</style>
</head>
<body>

<div class="bg bg-box-1"></div>
<div class="bg bg-box-2"></div>
<div class="bg bg-box-3"></div>
<div class="bg bg-box-4"></div>
<div id="wrap">
  <ul>
    <li>
      <div>
        <p>PHP中文网线上培训班</p>
      </div>
    </li>
    <li>
      <div>
        <p>创建一个属于自己的框架</p>
      </div>
    </li>
    <li>
      <div>
        <p>企业站点开发</p>
      </div>
    </li>
    <li>
      <div>
        <p>PHP中文网--这个专注编程教育的网站</p>
      </div>
    </li>
  </ul>
</div>
<script src="http://www.lanrenzhijia.com/ajaxjs/jquery.min.js"></script>
<script type="text/javascript">
(function(){
  $('#wrap li').mouseover(function(){
    if(!$(this).hasClass('curr')){
      $('#wrap li').removeClass('curr');
      $(this).addClass('curr');

      // 切换背景
      $('#wrap li').each(function(index){
        if($(this).hasClass('curr')){
          $('.bg').fadeOut(300);
          $('.bg:eq(' + index + ')').fadeIn(500);
        }
      });

      $('.curr').stop().animate({
        width: 700
      }, 500, 'linear');
      $('#wrap li').not('.curr').stop().animate({
        width: 100
      }, 500, 'linear');
    }
  });
})()
</script>

</body>
</html>
登录后复制

以上是jquery手风琴焦点动画的源码,感兴趣或者需要的同学可以直接拿去使用、研究!更多文章、源码请到PHP中文网搜索哦~~

相关推荐:

jquery标题选择动画

jQuery实现div跟随鼠标移动的代码案例

jquery实现手势解锁源码

以上就是jquery手风琴焦点动画的详细内容,更多请关注php中文网其它相关文章!

最佳 Windows 性能的顶级免费优化软件
最佳 Windows 性能的顶级免费优化软件

每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。

下载
来源:php中文网
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
最新问题
开源免费商场系统广告
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习
PHP中文网抖音号
发现有趣的

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号