多用途弹出框插件 jQuery角点弹出

  • 源码大小:710.09KB
  • 所需积分:1积分
  • 源码编号:19JP-3777
  • 浏览次数:761次
  • 最后更新:2023年07月22日
  • 所属栏目:其他
我要下载
加入收藏
本站默认解压密码:19jp.com 或 19jp_com

简介

Corner Popup jQuery插件为您提供了一个灵活、多用途、高度可定制的弹出框解决方案,用于现代网页设计。

可用于警报对话框、cookie通知弹出窗口、吐司通知、确认弹出窗口等。

主要功能:

  • 滑动或淡入淡出动画。
  • 超时后自动解除。用于吐司通知。
  • 弹出框中的自定义图像。
  • AJAX内容加载。
  • 自定义动作按钮。
  • 可以定位在页面的左下角、中下角或右下角。
  • 多达10种变体,可满足您的任何需求。

如何使用它:

1.在网页上包含角点弹出菜单的JavaScript和样式表。请注意,该插件需要最新的jQuery库才能工作。

  1. <link rel="stylesheet" href="/path/to/css/corner-popup.min.css">
  2. <script src="/path/to/cdn/jquery.min.js"></script>
  3. <script src="/path/to/js/corner-popup.min.js"></script>

2.在网页的右下方创建一个标准的弹出框。

  1. $('body').cornerpopup({
  2. popupimg: "image.png",
  3. link1: "https://www.jqueryscript.net",
  4. header: "Header Content",
  5. button1: "Read More"
  6. });

3.指定要使用的弹出窗口类型。所有可能的变体:

  1. 标准弹出窗口
  2. cookie通知弹出窗口
  3. 带有按钮的弹出消息
  4. 不带按钮的弹出消息
  5. 文本弹出窗口
  6. 信息弹出窗口
  7. 仅标题
  8. 页眉+文本
  9. 标题+文本+图像
  10. 自定义内容
  1. $('body').cornerpopup({
  2. 'variant': 1
  3. });

4.自定义弹出框的外观。

  1. $('body').cornerpopup({
  2. shadow: 1,
  3. width: "390px",
  4. font: "'Open Sans', 'Halvetica', sans-serif",
  5. colors: "#543189",
  6. bgcolor: "#fff",
  7. bordercolor: "#efefef",
  8. textcolor: "#181818",
  9. iconcolor: "#543189",
  10. btncolor: "#543189",
  11. btntextcolor: "#fff",
  12. corners: "0px",
  13. padding: 0
  14. });

5.更多具有默认值的自定义选项。

  1. $('body').cornerpopup({
  2.  
  3. // 0 = disable
  4. active: 1,
  5. // 1 = slide animation
  6. // 0 = fade animation
  7. slide: 0,
  8.  
  9. // 1 = slide top
  10. slidetop: 0,
  11.  
  12. // auto dismisses after this timeout
  13. timeout: 0,
  14.  
  15. // shows the popup after the amount of time you set
  16. delay: 0,
  17.  
  18. // 1 = shows close button
  19. closebtn: 1,
  20. // link for standard popup
  21. link1: "https://wp.pl, _self",
  22.  
  23. // link for other popups
  24. link2: "#, _self",
  25.  
  26. // image for standard popup
  27. popupimg: "img/img-1.png",
  28.  
  29. // image for cookie notice popup
  30. cookieimg: "img/cookie.png",
  31.  
  32. // image for message popup
  33. messageimg: "img/icon-3.png",
  34. // text for cookie notice popup
  35. text1: 'This website uses cookies to ensure you get the best experience on our website. <a href="http://www.allaboutcookies.org" target="_blank" class="cookie-more">More information.</a>',
  36.  
  37. // text for other popups
  38. text2: "This is just a sample text. Feel free to change it to your own using proper parameter.",
  39.  
  40. // custom buttons
  41. button1: "more",
  42. button2: "Got it", // for cookie notice popup
  43. button3: "OK",
  44.  
  45. // for custom content popup
  46. content: "Your own html here.",
  47.  
  48. // used for external source
  49. loadcontent: "no",
  50.  
  51. // left, center or right
  52. position: "right",
  53.  
  54. // closes pop-up window after Escape key is pressed
  55. // 1 = true
  56. escClose: 0,
  57.  
  58. // sticks pop-up window to the edge of the browser
  59. // 1 = true
  60. stickToBottom: 0,
  61.  
  62. // makes the popup appear at the top of the browser window
  63. topCorner: 0
  64.  
  65. });

6.手动显示/隐藏弹出窗口。“delay”参数是可选的。

  1. $.fn.cornerpopup.popupClose(delay);
  2. $.fn.cornerpopup.popupHide(delay);
  3. $.fn.cornerpopup.popupShow(delay);

7.事件处理程序。

  1. $('body').cornerpopup({
  2.  
  3. beforePopup : function(){},
  4. afterPopup : function(){},
  5. onBtnClick: function(){}
  6.  
  7. });

更新日志:

2021-12-15

  • 键盘可访问性改进

2020-12-24

  • 修复了非工作按钮“目标”属性的错误

2020-09-27

  • 修复了Safari上无法使用的按钮链接
  • 改进了手机外观

2020-09-19

  • 增加了在链接1和链接2中更改“目标”属性的功能

2020-03-11

  • 增加了延迟和顶角选项。

2020-03-09

  • 添加了新选项(padding、stickToBottom)和新事件(onBtClick)

2020-03-07

  • 删除了导致loadContent选项出现故障的错误

2020-03-02

  • 更正了以百分比为单位的宽度的列设置/较高宽度时的关闭按钮错误

2020-03-01

  • 删除了宽度更改时列和按钮的错误
  • 添加了带有延迟选项的新方法

2020-02-17

  • 改进了与Bootstrap 4的兼容性

2019-07-26

  • 添加了方法/事件,修复了位置错误:移动设备上的左/右

2019-07-15

  • 已更正Escape按钮的问题

预览截图