zoukankan      html  css  js  c++  java
  • 简单收展、覆盖的广告效果

      一、效果1

          

    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="UTF-8">
    <title>Document</title>
    <script src="./jquery.min.js"></script>
    <style type="text/css">
        img{display:block;border:none 0;}
           .bg{width:400px;padding:20px 10px;background-color:skyblue;}
           .banner{width:400px;height:300px;border:1px solid orange;margin:0 auto;position:relative;}
           .closeBtn{width:24px;height:24px;background:url("http://offlintab.firefoxchina.cn/static/img/icon/controls-431.png") no-repeat -60px -2px;cursor:pointer;position:absolute;top:5px;right:5px;}
    </style>
    </head>
    <body>
        <div class="bg">
            <div class="banner">
                <img src="https://www.baidu.com/img/bd_logo1.png" width="400px" height="300px">
                <div class="closeBtn"></div>
            </div>
        </div>
    
        <script type="text/javascript">
            $(function(){
                $(".closeBtn").click(function(){
                    $(".banner").slideUp(100);
                });
            });
        </script>
    </body>
    </html>

    二、效果2

          

    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="UTF-8">
    <title>Document</title>
    <script src="./jquery.min.js"></script>
    <style type="text/css">
        img{display:block;border:none 0;}
           .banner{width:270px;height:129px;border:1px solid orange;overflow:hidden;position:relative;}
           .underCont{width:270px;height:129px;}
           .coverObj{width:270px;height:129px;background-color:rgba(0,0,0,0.5);position:absolute;left:0;top:129px;}
           /*透明背景图:1.直接使用透明背景的图片 2.opacity:0~1;filter:alpha(opacity=0~1);*/
    </style>
    </head>
    <body>
        <div class="banner">
            <div class="underCont">
                <img src="https://www.baidu.com/img/bd_logo1.png" width="270px" height="129px">
            </div>
            <div class="coverObj"></div>
        </div>
    
        <script type="text/javascript">
            $(function(){
                $(".banner").hover(function(){
                    $(".coverObj").animate({top:"0"},1000);
                },function(){
                    $(".coverObj").animate({top:"129px"},1000);
                });
            });
        </script>
    </body>
    </html>
  • 相关阅读:
    LostRoutes项目日志——玩家飞机精灵Fighter解析
    quartz Cron表达式一分钟教程
    vue-cli入门
    SQL中merge into用法
    SQLSERVER查询那个表里有数据
    C#实现复杂XML的序列化与反序列化
    MVC和WebApi 使用get和post 传递参数。
    项目管理软件推荐
    JS跨域请求
    Android动画效果translate、scale、alpha、rotate详解
  • 原文地址:https://www.cnblogs.com/zhouwanqiu/p/8948007.html
Copyright © 2011-2022 走看看