Greasy Fork is available in English.

MyModal

原生js弹出层

Script này sẽ không được không được cài đặt trực tiếp. Nó là một thư viện cho các script khác để bao gồm các chỉ thị meta // @require https://update.greasyfork.org/scripts/463930/1177945/MyModal.js

Tác giả
wish king
Phiên bản
0.0.1.20230419051637
Đã tạo
13-04-2023
Đã cập nhật
19-04-2023
Giấy phép
N/A

简单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();
});