码迷,mamicode.com
首页 > 其他好文 > 详细

12.手风琴效果

时间:2018-10-03 21:49:49      阅读:154      评论:0      收藏:0      [点我收藏+]

标签:cti   ext   none   charset   手风琴效果   images   code   src   oat   

效果图:

技术分享图片

源码:

<!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.手风琴效果

标签:cti   ext   none   charset   手风琴效果   images   code   src   oat   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!