<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script>
<script type="text/javascript">
var move=(function(){
var px=0;
var getmovepx=function(){
return px+=event.wheelDelta;
}
return {
movediv:function(){
$("#test01").children("div").css({"left":getmovepx(),"position":"absolute"});
}
}
}());
</script>
</head>
<body>
<div id="test01" style="background-color:#00FF00; width:1400px;height:200px;" onmousewheel="move.movediv()">
<div id="testdiv" style="width:280px; height:100px;background:url(http://datacvg.com/cn/images/111_r1_c2.jpg);" >
</div>
</div>
</body>
</html>
javascript 鼠标 左移右移
最新推荐文章于 2022-05-07 11:50:24 发布