博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
图片翻转导航
阅读量:5368 次
发布时间:2019-06-15

本文共 2636 字,大约阅读时间需要 8 分钟。

<doctype html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>jquery实现图片翻牌旋转特效</title>
        <style>
            *{margin:0px;padding:0px;}
            li{list-style:none;}
            #brand{
                width:330px;
                height:400px;
                border:1px solid #dddddd;
                box-shadow:0px 0px 5px #dddddd;
                margin:30px auto;
            }
            #brand .title{
                width:100%;
                height:35px;
                line-height:35px;
                font-size:16px;
                margin-top:4px;
                border-bottom:2px solid #33261c;
                text-align:center;
                color:#33261c;
            }
            #brand .bd-box{
                width:284px;
                height:358px;
                overflow:hidden;
                padding:0px 24px;
            }
            #brand .bd-box li{
                float:left;
                width:122px;
                height:77px;
                overflow:hidden;
                position:relative;
                margin:10px 10px 0px 10px;
            }
            #brand .bd-box li img{
                width:120px;
                height:75px;
                border:1px solid #e9e8e8;
                position:absolute;
                left:0px;
                top:0px;
                z-index:2;
                overflow:hidden;
            }
            #brand .bd-box li span{
                width:120px;
                height:0px;
                border:1px solid #e9e8e8;
                position:absolute;
                left:0px;
                top:38px;
                z-index:1;
                text-align:center;
                line-height:75px;
                font-size:14px;
                color:#FFF;
                background:#ffa340;
                font-weight:bold;
                overflow:hidden;
                display:none;
            }
            #brand .bd-box li a{
                width:120px;
                height:75px;
                position:absolute;
                left:0px;
                top:0px;
                z-index:3;
            }
        </style>
        <script type="text/javascript" src="jquery-1.8.3.js"></script>
        
    </head>
    <body>
        <div id="brand">
            <div class='title'>
                热门品牌推荐
            </div>
            <ul class='bd-box'>
                <li>
                    <a href="http://www.school.com"> </a>
                    <img src="images/1.jpg" />
                    <span>肌龄</span>
                </li>
                <li>
                    <a href="http://www.school.com"> </a>
                    <img src="images/2.jpg" />
                    <span>肌龄</span>
                </li>
                <li>
                    <a href="http://www.school.com"> </a>
                    <img src="images/3.jpg" />
                    <span>肌龄</span>
                </li>
                <li>
                    <a href="http://www.school.com"> </a>
                    <img src="images/4.jpg" />
                    <span>肌龄</span>
                </li>
                <li>
                    <a href="http://www.school.com"> </a>
                    <img src="images/5.jpg" />
                    <span>肌龄</span>
                </li>
                <li>
                    <a href="http://www.school.com"> </a>
                    <img src="images/6.jpg" />
                    <span>肌龄</span>
                </li>
                <li>
                    <a href="http://www.school.com"> </a>
                    <img src="images/7.jpg" />
                    <span>肌龄</span>
                </li>
                <li>
                    <a href="http://www.school.com"> </a>
                    <img src="images/8.jpg" />
                    <span>肌龄</span>
                </li>
            </ul>
        </div>
        
    </body>
</html>
<script type="text/javascript">
    /*
     1、鼠标移入 -- 改变li中 img 的 height = 0 top : h/2 , 改变span 的 height :h   top : 0
     2、鼠标移出 -- 改变 span 再改变 img
    * */
    $("li").hover(function(){
        $(this).find("img").animate({"height" : 0 , "top" : 38},800,function(){
            $(this).hide();
            $(this).next().show().animate({"height" : 75 , "top" : 0},800);
        })
    },function(){
        $(this).find("span").animate({"height" : 0 , "top" : 38},800,function(){
            $(this).hide();
            $(this).prev().show().animate({"height" : 75 , "top" : 0},800);
        })
    })
    
</script>

转载于:https://www.cnblogs.com/tis100204/p/10328979.html

你可能感兴趣的文章
《30天自制操作系统》学习笔记--第14天
查看>>
LGPL协议的理解
查看>>
1、Python基础
查看>>
Unity The Tag Attribute Matching Rule
查看>>
试着理解下kvm
查看>>
WebService学习总结(二)--使用JDK开发WebService
查看>>
Tizen参考手机RD-210和RD-PQ
查看>>
竞价广告系统-位置拍卖理论
查看>>
策略模式 C#
查看>>
[模板]树状数组
查看>>
[HDU 6447][2018CCPC网络选拔赛 1010][YJJ's Salesman][离散化+线段树+DP]
查看>>
设计模式学习的好方法
查看>>
感谢Leslie Ma
查看>>
几种排序方法
查看>>
查看数据库各表的信息
查看>>
第一阶段测试题
查看>>
第二轮冲刺第五天
查看>>
图片压缩
查看>>
Hadoop-2.6.5安装
查看>>
ES6思维导图
查看>>