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>
  • 相关阅读:
    Python openpyxl的使用
    Python字典的遍历
    Python3元组的简介和遍历
    tableau绘制饼图
    tableau创建点位地图
    tableau绘制热力地图
    select下拉框分组使用bootstrap select
    css设置div中table水平居中
    sql server的分组排序partition by函数
    document.ready
  • 原文地址:https://www.cnblogs.com/Doduo/p/8023330.html
Copyright © 2011-2022 走看看