• 极简无插件前端弹框提示代码,码好


    #不想引各种乱七八糟的插件,就想要个弹框。这份代码是你最好的选择!!

    <!DOCTYPE html> <html> <head> <title>测试自定义弹框</title> </head> <style type="text/css"> .my-toast{ background-color: rgba(0,0,0,0.6); min- 3rem; min-height: 1rem; text-align: center; font-size: 12px; position: fixed; top: 50%; left: 50%; white-space: nowrap; transform: translate(-50%,-50%); color: #EEEEEE; padding: .3rem .4rem; z-index: 999; } </style> <body> <button type="button" onclick="myToast('你点击我了~')" style=" 100px;height: 50px;background-color: gray;cursor: pointer;">点我</button> </body> <script type="text/javascript"> function myToast(str,timer=1500){ var toast=document.createElement('div') toast.className='my-toast' toast.innerHTML=str||'成功'; document.getElementsByTagName('body')[0].appendChild(toast) setTimeout(function(){ toast.className+=' fadeOut' toast.remove() },timer) } </script> </html>   

    效果如图: 

     

    滴水成冰,世间不存在毫无意义的付出,时间终会给你答案。
  • 相关阅读:
    二分和三分
    windows对拍及其应用
    RMQ与st表
    图论最短路
    图论最小生成树
    贪心问题
    [转载]图论500题
    第二次重建博客。。
    二分和三分题
    树状数组
  • 原文地址:https://www.cnblogs.com/soupig/p/15598858.html
Copyright © 2020-2023  润新知