Greasy Fork is available in English.
原生js弹出层
        此脚本不应直接安装。它是供其他脚本使用的外部库,要使用该库请加入元指令 // @require https://update.greasyfork.icu/scripts/463930/1177945/MyModal.js
      
简单js弹出层
截图:


在线预览:
https://jsrun.net/gddKp/embedded/all/light
使用示例:
document.querySelector("#test1").addEventListener("click", function(){
  new MyModal({
    top: '',
    width: '50%',
    height: 'auto',
    borderRadius: '5px',
    zIndex: 1010,
    //null,不显示title
    title: 'test1',
    //支持HTML格式,null不显示content
    content: 'Hello World!',
    //closeText:null,不显示关闭按钮
    closeText: '关闭',
    closeWidth: '',
    //okText:null,不显示ok按钮
    okText: '好了',
    okWidth: '',
    //closeFn和okFn可以省略
    closeFn: function (e) {
      console.log('closeFn clicked');
      e.myModal.close();
    },
    okFn: function (e) {
      console.log('okFn clicked');
      e.myModal.close();
    }
  }).show();
});