| 发表于:2007-07-18 17:49:39 楼主 |
一个层,鼠标按住后可以在页面上拖动,但是如果拖动速度过快,鼠标就会移出层区域,拖动终止? 怎么预防这样的现象? 1.鼠标可以移出层,但是有某个缓冲容器能记录鼠标路径,随后层会继续移动到鼠标位 2.用某个方式让鼠标无法快速移出层的区域 3.层拖动的定位方式重写 哪个是比较合适的解决方法? ps : 4.无解 ============================================================== <%@ page language= "java " import= "java.util.* " pageencoding= "utf-8 "%> <% string path = request.getcontextpath(); string basepath = request.getscheme()+ ":// "+request.getservername()+ ": "+request.getserverport()+path+ "/ "; %> <!doctype html public "-//w3c//dtd html 4.01 transitional//en "> <html> <base href= " <%=basepath%> "> <head> <title> my jsp 'test.jsp ' starting page </title> <script type= "text/javascript "> var mx; var my; var flag=0; function get_x(){ mx=event.x; my=event.y; } function mousedown() { mx=event.x; my=event.y; flag=1; } function mouseup() { flag=0; } function mousemove() { if(flag==0)return false; var e=document.getelementbyid( 'aa '); mxmov=event.clientx; mymov=event.clienty; var w=e.offsetwidth; e.style.width=parseint(w)+parseint(mxmov-mx); } </script> <style type= "text/css "> div{float:left;} .aacss{border:1px solid red;width:200px;height:100px;} </style> </head> <body onmousemove= "get_x() "> <div id= "body " onmouseup= "mouseup() "> <div id= "aa " class= "aacss "> aaaa </div> <div onmousedown= "mousedown() " onmousemove= "mousemove() " id= "bb " style= "width:30px;border:1px solid gary; "> dragme </div> </div> </body> </html> |
|
|
|
|