首页看下效果
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="js/jquery-1.12.3.js" ></script>
<title>漂浮</title>
<body style="min-width:1200px;">
<DIV onmouseover="pause_resume()" onmouseout="pause_resume()" id=imgdiv style="Z-INDEX: 10000; WIDTH: 200px; POSITION: absolute; HEIGHT: 100px;
visibility: visible;"><a href="/" target="_blank"><img src="fl-banner.jpg" width="200" height="100" border="0"></a></DIV>
<div align="center">
<p>
<SCRIPT>
var xPos = 0;
var yPos = 0;
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;
imgdiv.style.top = yPos;
function changePos() {
width = $(document.body).width();
//width = document.body.clientWidth;
height = $(window).height();
//height = document.body.clientHeight;
Hoffset = imgdiv.offsetHeight;
Woffset = imgdiv.offsetWidth;
//console.log(yPos , document.body.scrollTop);
//imgdiv.style.left = xPos + document.body.scrollLeft;
//imgdiv.style.top = yPos + document.body.scrollTop;
$("#imgdiv").css({"top":yPos ,"left":xPos});
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(){
imgdiv.visibility = "visible";
interval = setInterval('changePos()', delay);
}
function pause_resume() {
if(pause) {
clearInterval(interval);
pause = false;
}else{
interval = setInterval('changePos()',delay);
pause = true;
}
}
start();
</SCRIPT>
</p>
</div>
</body>
</html>