创建在屏幕上移动 浮动广告 jQuery bay window.js

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

简介

bay-window.js是一个jQuery插件,它可以从任何DOM元素创建浮动弹出窗口,并使它们在网页上移动。

这个插件不仅仅是一个最初为消息设计的普通弹出窗口:它甚至可以在屏幕上移动,从而优于页面的主要内容。可用于广告、促销、公告或显示重要内容。

如何使用它:

1.加载JavaScriptjquery.bay-window.js查询在文档中。

  1. <script src="/path/to/cdn/jquery.slim.min.js"></script>
  2. <script src="/path/to/jquery.bay-window.js"></script>

2.动态创建一个浮动弹出窗口。

  1. $.createBayWindowElement({
  2.  
  3. // width/height of the popup window
  4. width: '400px',
  5. height: '300px',
  6.  
  7. // path to the ads image
  8. src: './images/bay-image.png',
  9.  
  10. // url
  11. href: 'https://www.jqueryscript.net',
  12. // target attribute
  13. target: '__blank',
  14.  
  15. // text to display in the close button
  16. closeText: 'close',
  17.  
  18. }).bayWindow({
  19.  
  20. // step length
  21. stepLength: 1,
  22.  
  23. // start position
  24. startTop: 0,
  25. startLeft: 0,
  26.  
  27. // z-index
  28. zIndex: 9999,
  29. })

3.从文档中现有的DOM元素创建一个浮动弹出窗口。

  1. <div class="custom" id="custom">
  2. ...
  3. </div>
  1. $('#custom').bayWindow({
  2. // options (see above) here
  3. })

4.API方法。

  1. // start the animation
  2. $('#custom').bayWindow('run');
  3.  
  4. // stop the animation
  5. $('#custom').bayWindow('stop');
  6.  
  7. // destroy the animation
  8. $('#custom').bayWindow('destroy');

预览截图