手风琴demo

先看一下效果图

进去把图片换一下

<!DOCTYPE html><!--DTD文档声明类型 HTML5 -->
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>手风琴demo</title>
    <style>
        *{margin:0;padding:0;}
        html,body{height:100%;}
        li{ list-style: none;}
        body{
            position:relative;
            /*参考物*/
        }
        .bg-box{
            /*绝对定位 谁动谁儿子 父相子绝*/
            position: absolute;
            top:0;
            left:0;
            width:100%;
            height:100%;
            background:#368 ;
        }
        .bg-box img{/*inline-block*/
            display: block;/*转换成会计元素,清楚默认的对其方式*/
            width:100%;
            height:100%;
        }
        #wrap{
            position: absolute;
            /*top:50%;*/
            /*left:50%;*/
            /*margin-left:-350px;*/
            /*margin-top:-150px;*/
            top:0;
            left:0;
            right:0;
            bottom:0;
            margin:auto;
            width:700px;
            height:300px;
            border:3px solid #000;
        }
        #wrap ul{
            width:120%;
        }
        #wrap ul li{
            width:100px;
            height:300px;
            background:url("img/big-img-1.jpg");
            float:left;
        }
        #wrap ul li div{
            width:100px;
            height:300px;
            background:rgba(0,0,0,0.5);
        }
        #wrap ul li div p{
            padding:10px 40px;
            color:#fff;
            text-align: center;
        }
        #wrap ul li:nth-child(2){
            background: url("img/big-img-2.jpg");
        }
        #wrap ul li:nth-child(3){
            background: url("img/big-img-3.jpg");
        }
        #wrap ul li:nth-child(4){
            width:400px;
            background: url("img/big-img-4.jpg");
            background-size:cover;
        }


    </style>
</head>
<body><!--页面呈现-->
<div>
    <div class="bg-box">
        <img src="img/big-img-1.jpg" width="994" height="626" alt="test"/>
    </div>
    <div class="bg-box">
        <img src="img/big-img-2.jpg" width="994" height="626" alt="test"/>
    </div>
    <div class="bg-box">
        <img src="img/big-img-3.jpg" width="994" height="626" alt="test"/>
    </div>
    <div class="bg-box">
        <img src="img/big-img-4.jpg" width="994" height="626" alt="test"/>
    </div>
</div>


   <div id="wrap">
       <ul>
           <li>
               <div>
                   <p>我的个人拉萨之旅 &nbsp|&nbsp &nbsp|&nbsp 哈哈哈</p>
               </div>
           </li>
           <li>
               <div>
                   <p>我的个人拉萨之旅 &nbsp|&nbsp &nbsp|&nbsp 哈哈哈</p>
               </div>
           </li>
           <li>
               <div>
                   <p>我的个人拉萨之旅 &nbsp|&nbsp &nbsp|&nbsp 哈哈哈</p>
               </div>
           </li>
           <li>
               <div>
                   <p>我的个人拉萨之旅 &nbsp|&nbsp &nbsp|&nbsp 哈哈哈</p>
               </div>
           </li>

       </ul>
   </div>

</body>
<script src="js/jquery-1.7.1.min.js"></script>
<script>
 var $li = $('#wrap ul li');
    var $bg = $('.bg-box');
    //li hover时候出发事件
    $li.hover(function(){
        var index = $(this).index();
        $bg.eq(index).fadeIn(300).siblings().fadeOut(300);
        $(this).stop().animate({
            width:'400px',
            'background-size':'cover'
        }).siblings('li').stop().animate({
            width:'100px'
        })
    })
</script>
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值