zoukankan      html  css  js  c++  java
  • Toast 原生封装

     Toast(msg, duration) {
          duration = isNaN(duration) ? 3000 : duration;
          var m = document.createElement("div");
          m.innerHTML = msg;
          m.style.cssText =
            "max-60%;min- 150px;padding:0 14px;height: 40px;color: rgb(255, 255, 255);line-height: 40px;text-align: center;border-radius: 4px;position: fixed;top: 50%;left: 50%;transform: translate(-50%, -50%);z-index: 999999;background: rgba(0, 0, 0,.7);font-size: 16px;";
          document.body.appendChild(m);
          setTimeout(function () {
            var d = 0.5;
            m.style.webkitTransition =
              "-webkit-transform " + d + "s ease-in, opacity " + d + "s ease-in";
            m.style.opacity = "0";
            setTimeout(function () {
              document.body.removeChild(m);
            }, d * 1000);
          }, duration);
        }
  • 相关阅读:
    页面 笔记
    快速统计一个数二进制中1的个数
    [JAVA] String 拼接效率
    [JAVA] String常用方法
    [letcode] 832 Flipping an Image
    [java]冒泡排序
    SharedPreferences
    归并排序
    安全退出调用多个Activity的Application
    Activity生命周期
  • 原文地址:https://www.cnblogs.com/lvzhenHome/p/13371641.html
Copyright © 2011-2022 走看看