首页 > 其他 > 详细

12.手风琴效果

时间:2018-10-03 11:39:10      阅读:241      评论:0      收藏:0      [点我收藏+]

效果图:

技术分享图片

源码:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title></title>
    <script src="jquery-3.3.1.js"></script>
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        ul{
            list-style: none;
        }
        a{
            text-decoration: none;
        }
        img{
            display: block;
        }
        .box{
            margin: 100px auto;
            width: 1060px;
            height: 250px;
            position: relative;
        }
        .box li{
            width: 210px;
            height: 250px;
            float: left;
        }
    </style>
    <script>
        $(function () {
            //可以用each(function(i,ele){})方法循环遍历
            $(".box li").each(function (i,ele) {
                $(ele).css("background","url(images/0"+(i+1)+".jpg)")
            }).mouseenter(function () {
                $(this).stop().animate({width:650},500).siblings("li").stop().animate({width:100},500);
            }).mouseleave(function () {
                $(".box li").stop().animate({width:210},500);
            })
        })
    </script>
</head>
<body>
<div class="box">
    <ul>
        <li></li>
        <li></li>
        <li></li>
        <li></li>
        <li></li>
    </ul>
</div>
</body>
</html>

图片跟上一文章一样

12.手风琴效果

原文:https://www.cnblogs.com/alex-xxc/p/9738779.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!