zoukankan      html  css  js  c++  java
  • toast组件较为完美版本

    <!DOCTYPE html>
    <html lang="en">
    
    <head>
    <meta charset="UTF-8">
    <title>Document</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <script src="jquery-3.0.0.min.js"></script>
    <style>
    .toast-container {
      position: fixed;
       100%;
      height: 100%;
      left: 100%;
      top: 100%;
    }
    
    .toast {
      position: absolute;
      top: -50%;
      left: -50%;
      transform: translate(-50%, -50%);
      padding: 13px 16px;
      font-size: 14px;
      color: #ccc;
      background: rgba(37, 38, 45, 0.9);
      border-radius: 2px;
       auto;
      /*可以输入的字数的宽度*/
      max- 20em;
    }
    </style>
    </head>
    
    <body>
    <script>
    var toastcome = function(msg) {
      var str = "<div class='toast-container' style='display:none'> <div class='toast'>" + msg + "</div></div>";
      $('body').append(str);
      $('.toast-container').stop().fadeIn(100).delay(1000).fadeOut(400); //fade out after 3 seconds
      setTimeout(function() {
        $('.toast-container').remove();
      }, 3000);
    }
    // toastcome("你好,我是谁不关你的事情,清理这里是我的责任,谢谢你好,我是谁不关你的事情,清理这里是我的责任,谢谢你好,我是谁不关你的事情,清理这里是我的责任,谢谢");
    toastcome("你好,我是谁");
    </script>
    <div class="toast-container">
      <div class="toast">你好,我是谁不关你的事情,清理这里是我的责任,谢谢</div>
    </div>
    </body>
    
    </html>
    

      

  • 相关阅读:
    退背包
    杜教筛BM
    Petya and Array CodeForces
    AC自动机模板
    KMP模板
    Docker系列器九:docker-compose与docker-compose.yml语法
    Fabric的简单Web应用
    ubuntu防火墙
    ubuntu16.04 HyperLedger Fabric 1.2.0 开发环境搭建
    crypto-config.yaml
  • 原文地址:https://www.cnblogs.com/zerohu/p/6269056.html
Copyright © 2011-2022 走看看