當(dāng)前位置:
首頁 >
浮动窗口代码(带关闭按钮+全屏漂浮)
發(fā)布時間:2025/3/15
37
豆豆
生活随笔
收集整理的這篇文章主要介紹了
浮动窗口代码(带关闭按钮+全屏漂浮)
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
?
?
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <title>帶關(guān)閉按鈕的浮動窗口代碼(全屏漂浮)</title> </head> <style type="text/css"> #fdck {border:1px solid #c0c0c0;margin:0 auto;padding:5px;background:#f0f0f0} </style> <body> <div id="img" style="position: absolute; left: 311; top: 815;visibility :hidden;" onmouseover="clearInterval(interval)" onmouseout="interval = setInterval('changePos()', delay)" align="middle"> <span style="CURSOR:hand;color:red;font-weight:bold;font-size:12px" onclick="clearInterval(interval);img.style.visibility = 'hidden'">關(guān)閉</span> <div id="fdck"> 歡迎來到營了個銷!<br> </div> </div> <script language=javascript> var xPos = 20; var yPos = document.body.clientHeight; var step = 1; var delay = 30; var height = 0; var Hoffset = 0; var Woffset = 0; var yon = 0; var xon = 0; var pause = true; var interval; img.style.top = yPos; function changePos() { width = document.body.clientWidth; height = document.body.clientHeight; Hoffset = img.offsetHeight; Woffset = img.offsetWidth; img.style.left = xPos + document.body.scrollLeft; img.style.top = yPos + document.body.scrollTop; if (yon) { yPos = yPos + step; } else { yPos = yPos - step; } if (yPos < 0) { yon = 1; yPos = 0; } if (yPos >= (height - Hoffset)) { yon = 0; yPos = (height - Hoffset); } if (xon) { xPos = xPos + step; } else { xPos = xPos - step; } if (xPos < 0) { xon = 1; xPos = 0; } if (xPos >= (width - Woffset)) { xon = 0; xPos = (width - Woffset); } } function start() { img.style.visibility = "visible"; interval = setInterval('changePos()', delay); } start(); </script> </body> </html>轉(zhuǎn)載于:https://www.cnblogs.com/linuxnewbie/p/5504340.html
總結(jié)
以上是生活随笔為你收集整理的浮动窗口代码(带关闭按钮+全屏漂浮)的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: MongoDB-JAVA-Driver
- 下一篇: QEMU-KVM中的多线程压缩迁移技术