<!doctype html>
<html> <head>
<meta charset="UTF-8" />
<title> 頁(yè)面名稱 </title>
</head>
<body>
<div style="width: 2500px; height: 800px; border: 1px solid red; border-radius: 50%;"></div>
<script type="text/javascript">
var tfv = 10;
var robj = document.compatMode=="CSS1Compat" ? document.documentElement :
document.body;
var timer;
var fuX = null;
function loop(){
robj.scrollLeft += tfv;
if (robj.scrollLeft<=0 || robj.scrollLeft>=robj.scrollWidth-robj.clientWidth)
tfv = -tfv;
}
timer = setInterval(loop, 50);
document.body.onmouseleave = function () {
clearInterval(timer);
timer = setInterval(loop, 50);
}
document.body.onmouseenter = function () {
clearInterval(timer);
}
document.onmousedown = function (e) {
e = e || window.event;
fuX = robj.scrollLeft + e.clientX;
return false;
}
document.onmousemove = function (e) {
if (fuX===null) return;
e = e || window.event;
robj.scrollLeft = fuX - e.clientX;
return false;
}
document.onmouseup = function (e) {
fuX = null;
}
</script>
</body>
</html>