zoukankan      html  css  js  c++  java
  • Toast

    <!doctype html>
    <html lang="en">
    
    <head>
        <meta charset="UTF-8">
        <title>加载中...</title>
    </head>
    
    <body>
        <button onclick="t()">弹出toast</button>
        <script src="http://lib.baomitu.com/jquery/3.2.1/jquery.min.js"></script>
        <script>
        var popToast = function() {}
        popToast.prototype = {
            timer: function(delay) {
                var t = null;
                clearTimeout(t);
                t = setTimeout(function() {
                    $(".toast-msg").fadeOut(200, function() {
                        $(".toast-msg").remove();
                    });
                }, delay);
            },
            toastMsg: function(content, position, delay) {
                var html = "";
                html = '<div class="toast-msg" style="position:fixed;margin:auto;padding:0.5rem 1.0rem;left:50%;bottom:1rem;transform: translate(-50%, -50%);-webkit-transform:translate(-50%, -50%);border-radius:0.33rem;font-size:1.08rem;color:#fff;background:rgba(0,0,0,.6);z-index:999;"><p>' + content + '</p></div>';
                if (position == 'center') {
                    html = '<div class="toast-msg" style="position:fixed;margin:auto;padding:0.5rem 1.0rem;top:50%;left:50%;transform: translate(-50%, -50%);-webkit-transform:translate(-50%, -50%);border-radius:0.33rem;font-size:1.08rem;color:#fff;background:rgba(0,0,0,.6);z-index:999;"><p>' + content + '</p></div>';
                }
                $("body").append(html);
                popToast.timer(delay);
            },
            remove: function(ele) {
                $(ele).remove();
            }
        }
        var popToast = new popToast();
    
        function t() {
            popToast.toastMsg('message123456','center',2000);
        }
        </script>
    </body>
    
    </html>
  • 相关阅读:
    从V$SQL_PLAN中FORMAT执行计划
    使用 vmstat 监测系统性能
    aix 计算性内存和文件内存
    AIX 配置vncserver
    批量杀进程——xargs用途
    Aix命令大全
    linux查看文件个数命令
    查看Unix系统是32位还是64位
    UTF-8与UTF-8 BOM
    jdk1.9之前版本及jdk9安装配置环境变量
  • 原文地址:https://www.cnblogs.com/Doduo/p/8023330.html
Copyright © 2011-2022 走看看