限时优惠活动
亲爱的苦力吧用户,我们为了回馈新老用户一直以来的鼎力支持,即日起(2025-02-06至2025-03-06)凡是购买苦力吧VIP/充值K币的新老用户,都直接可获得买一送一的优惠馈赠。例如:购买一个月的VIP会员可直接获得两个月的VIP会员;充值100K币可直接获得200K币,以此类推!有任何疑问可联系在线客服,感谢各位用户对苦力吧素材的信任与厚爱,我们将一如既往的给大家上新更多优质的素材源码,祝大家开工大吉、工作顺利、心想事成。

jquery支持自定义的提示框弹出层插件

所属分类: 网页特效-弹出层    2023-07-29 08:23:41

jquery支持自定义的提示框弹出层插件 ie兼容6
 查看演示  登录后下载 温馨提示
登录会员即可享受免费下载
 我要建站

jquery支持自定义的提示框弹出层插件(共9个文件)

    • index.html

使用方法

  • code
  • source
  1. (function() {
  2. const resultLog = document.getElementById('result_log');
  3. const pageForm = document.getElementById('page_form');
  4. const jsForm = document.createElement('form');
  5. jsForm.classList.add('demo_form');
  6. // jsForm.style.setProperty('width', '300px');
  7. // jsForm.style.setProperty('margin', '10px');
  8. // jsForm.style.setProperty('padding', '20px');
  9. // jsForm.style.setProperty('border', '1px solid #000');
  10. const formOptions = {
  11. title: 'Your favorite browser',
  12. info: pageForm,
  13. ok: () => {
  14. getFormValue();
  15. },
  16. no: () => {},
  17. // baseClass: '',
  18. };
  19. document.getElementById('settings_form').addEventListener('change', (e) => {
  20. const el = e.target;
  21. const value = el.value;
  22. const nodeName = el.nodeName.toLowerCase();
  23. if (['input', 'select'].indexOf(nodeName) >= 0) {
  24. switch (el.name) {
  25. case 'theme':
  26. cxDialog.defaults.baseClass = value;
  27. break;
  28. case 'title':
  29. cxDialog.defaults.title = value == 1 ? 'cxDialog' : '';
  30. break;
  31. case 'maskClose':
  32. cxDialog.defaults.maskClose = Boolean(parseInt(value, 10));
  33. break;
  34. case 'form':
  35. formOptions.info = value === 'js' ? jsForm : pageForm;
  36. break;
  37. };
  38. };
  39. });
  40. document.body.addEventListener('click', (e) => {
  41. const el = e.target;
  42. const nodeName = el.nodeName.toLowerCase();
  43. if (nodeName === 'a' && el.rel) {
  44. const rel = el.rel;
  45. switch (rel) {
  46. case 'alert':
  47. cxDialog('Hello World<br>I am cxDialog');
  48. break;
  49. case 'ok':
  50. cxDialog({
  51. info: 'Get started with the <strong>cxDialog</strong>',
  52. ok: () => {
  53. addLog('OK');
  54. }
  55. });
  56. break;
  57. case 'confirm':
  58. cxDialog({
  59. info: 'Get started with the <strong>cxDialog</strong>',
  60. ok: () => {
  61. addLog('OK');
  62. },
  63. no: () => {
  64. addLog('Cancel');
  65. },
  66. });
  67. break;
  68. case 'article':
  69. const opts = {
  70. info: Array(99).fill('Article Content'),
  71. buttons: []
  72. };
  73. opts.info.unshift('<div style="width:9999px;background:linear-gradient(to right,rgba(0,0,0,1) 0%,rgba(0,0,0,0.1) 100%);color:#fff;">Wider Content</div>');
  74. opts.info = opts.info.join('<br>');
  75. for (let i = 0; i < 9; i++) {
  76. opts.buttons.push({
  77. text: 'Button' + i,
  78. callback: () => {
  79. addLog('Button' + i)
  80. }
  81. });
  82. };
  83. cxDialog(opts);
  84. break;
  85. case 'text':
  86. formOptions.info.innerHTML = '<div class="setvalue"><input name="name" type="text"></div>';
  87. cxDialog(formOptions);
  88. break;
  89. case 'radio':
  90. createOptions('radio');
  91. cxDialog(formOptions);
  92. break;
  93. case 'checkbox':
  94. createOptions('checkbox');
  95. cxDialog(formOptions);
  96. break;
  97. case 'login':
  98. cxDialog(formOptions);
  99. break;
  100. };
  101. };
  102. });
  103. const createOptions = (type) => {
  104. let now = new Date().getTime();
  105. let html = '<div class="setvalue">';
  106. for (let x of ['Chrome','Edge','Firefox']) {
  107. let id = x.toLowerCase() + now;
  108. html += '<input type="' + type + '" name="name" id="' + id + '" value="' + x + '"><label for="' + id + '">' + x + '</label>';
  109. };
  110. html += '</div>';
  111. formOptions.info.innerHTML = html;
  112. };
  113. const getFormValue = () => {
  114. const formData = new FormData(formOptions.info);
  115. const values = [];
  116. for (let x of formData.entries()) {
  117. if (x[0] === 'name') {
  118. values.push(x[1]);
  119. };
  120. };
  121. addLog(values.join(','));
  122. };
  123. const addLog = (text) => {
  124. resultLog.insertAdjacentHTML('beforeend', text + '<br>')
  125. };
  126. })();
(function() {
  const resultLog = document.getElementById('result_log');
  const pageForm = document.getElementById('page_form');
  const jsForm = document.createElement('form');
  jsForm.classList.add('demo_form');
  // jsForm.style.setProperty('width', '300px');
  // jsForm.style.setProperty('margin', '10px');
  // jsForm.style.setProperty('padding', '20px');
  // jsForm.style.setProperty('border', '1px solid #000');

  const formOptions = {
    title: 'Your favorite browser',
    info: pageForm,
    ok: () => {
      getFormValue();
    }, 
    no: () => {},
    // baseClass: '',
  };

  document.getElementById('settings_form').addEventListener('change', (e) => {
    const el = e.target;
    const value = el.value;
    const nodeName = el.nodeName.toLowerCase();

    if (['input', 'select'].indexOf(nodeName) >= 0) {
      switch (el.name) {
        case 'theme':
          cxDialog.defaults.baseClass = value;
          break;

        case 'title':
          cxDialog.defaults.title = value == 1 ? 'cxDialog' : '';
          break;

        case 'maskClose':
          cxDialog.defaults.maskClose = Boolean(parseInt(value, 10));
          break;

        case 'form':
          formOptions.info = value === 'js' ? jsForm : pageForm;
          break;
      };
    };
  });

  document.body.addEventListener('click', (e) => {
    const el = e.target;
    const nodeName = el.nodeName.toLowerCase();

    if (nodeName === 'a' && el.rel) {
      const rel = el.rel;

      switch (rel) {
        case 'alert':
          cxDialog('Hello World<br>I am cxDialog');
          break;

        case 'ok':
          cxDialog({
            info: 'Get started with the <strong>cxDialog</strong>',
            ok: () => {
              addLog('OK');
            }
          });
          break;

        case 'confirm':
          cxDialog({
            info: 'Get started with the <strong>cxDialog</strong>',
            ok: () => {
              addLog('OK');
            },
            no: () => {
              addLog('Cancel');
            },
          });
          break;

        case 'article':
          const opts = {
            info: Array(99).fill('Article Content'),
            buttons: []
          };

          opts.info.unshift('<div style="width:9999px;background:linear-gradient(to right,rgba(0,0,0,1) 0%,rgba(0,0,0,0.1) 100%);color:#fff;">Wider Content</div>');
          opts.info = opts.info.join('<br>');

          for (let i = 0; i < 9; i++) {
            opts.buttons.push({
              text: 'Button' + i,
              callback: () => {
                addLog('Button' + i)
              }
            });
          };

          cxDialog(opts);
          break;

        case 'text':
          formOptions.info.innerHTML = '<div class="setvalue"><input name="name" type="text"></div>';
          cxDialog(formOptions);
          break;

        case 'radio':
          createOptions('radio');
          cxDialog(formOptions);
          break;

        case 'checkbox':
          createOptions('checkbox');
          cxDialog(formOptions);
          break;

        case 'login':
          cxDialog(formOptions);
          break;
      };
    };
  });

  const createOptions = (type) => {
    let now = new Date().getTime();
    let html = '<div class="setvalue">';

    for (let x of ['Chrome','Edge','Firefox']) {
      let id = x.toLowerCase() + now;
      html += '<input type="' + type + '" name="name" id="' + id + '" value="' + x + '"><label for="' + id + '">' + x + '</label>';
    };

    html += '</div>';

    formOptions.info.innerHTML = html;
  };

  const getFormValue = () => {
    const formData = new FormData(formOptions.info);
    const values = [];

    for (let x of formData.entries()) {
      if (x[0] === 'name') {
        values.push(x[1]);
      };
    };

    addLog(values.join(','));
  };

  const addLog = (text) => {
    resultLog.insertAdjacentHTML('beforeend', text + '<br>')
  };
})();

站长提示:
1. 苦力吧素材官方QQ群:950875342
2. 平台上所有素材资源,需注册登录会员方能正常下载。
3. 会员用户积极反馈网站、素材资源BUG或错误问题,每次奖励2K币
4. PHP源码类素材,如需协助安装调试,或你有二次开发需求,可联系苦力吧客服。
5. 付费素材资源,需充值后方能下载,如有任何疑问可直接联系苦力吧客服
相关资源 / 弹出层

jquery响应式弹出cookie同意提示框插件

第一次访问网站页面时,此插件会在网站上显示cookie同意(数据收集策略)弹出窗口。
  弹出层
 1977  0

jquery手机移动端多模态弹出框插件

一款移动端弹出层插件,包含了多模态:确认对话框、对话框、表单输入弹出框、loading加载动画等。
  弹出层
 9150  0

jquery带遮罩层的文字提示工具插件

此插件包含了多种提示特效:自动触发、单击触发、鼠标悬停触发、鼠标悬停ajax回调触发等。
  弹出层
 1353  0

jquery响应式自动关闭的消息通知栏插件

一款轻量级通知消息栏特效,点击右侧按钮触发底部弹出显示消息通知,可自定义时间消息或点击关闭。
  弹出层
 3338  0

评论数(0) 回复有机会获得K币 用户协议

^_^ 还没有人评论,快来抢个沙发!
😀
  • 😀
  • 😊
  • 😂
  • 😍
  • 😑
  • 😷
  • 😵
  • 😛
  • 😣
  • 😱
  • 😋
  • 😎
  • 😵
  • 😕
  • 😶
  • 😚
  • 😜
  • 😭
发表评论