javascript 层缩放问题(望得贵人帮忙)解决问题再加分,谢谢!
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了javascript 层缩放问题(望得贵人帮忙)解决问题再加分,谢谢!相关的知识,希望对你有一定的参考价值。
哪位大虾帮忙帮我把这段鼠标拖动层代码改造一下,让鼠标可以缩放层的大小,就像窗口一样的那种(firefox要兼容的),一定在我的原码上改动,并且加上注释,谢谢了,搞定的话一定追加分数给你!
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>拖动层</title>
</head>
<script language="javascript" >
var x=0,y=0,x1=0,y1=0;
var moveable=false;
var index=10000;
//开始拖动
function startDrag(obj,evt)
e=evt?evt:window.event;
if(true)
if (!window.captureEvents)
obj.setCapture();
else
window.captureEvents(Event.MOUSEMOVE|Event.MOUSEUP);
var win=obj.parentNode;//取得父窗体
win.style.zIndex=++index;//设置父窗体的Z轴值
x= e.clientX;//取得当前鼠标的X坐标
y= e.clientY;//取得当前鼠标的Y坐标
x1 = parseInt(win.style.left);//将父窗体的距浏览器左边界的距离转换为NUMBER
y1 = parseInt(win.style.top);//将父窗体的距浏览器上边界的距离转换为NUMBER
moveable=true;
function drag(obj,evt)
e=evt?evt:window.event;
if(moveable)
var win=obj.parentNode;
win.style.left=x1+e.clientX-x;
win.style.top=y1+e.clientY-y;
//停止拖动
function stopDrag(obj)
if(moveable)
if (!window.captureEvents)
obj.releaseCapture();
else
window.releaseEvents(Event.MOUSEMOVE|Event.MOUSEUP);
moveable = false;
</script>
<body >
<div id="l1" style="position:absolute; width:200px; height:200px; background-color:#99CCFF; z-index:200; top:100px; left:50px;">
<div id="title" onMouseDown="startDrag(this,event)" onMouseMove="drag(this,event)" onMouseUp="stopDrag(this)" style="width:200px; height:20px; background-color:#330033; top:0px; left:0px; z-index:200; position:absolute; font-size:9pt; color:#FFFFFF; padding-top:5px; padding-left:5px;">浮动窗口</div>
</div>
</body>
</html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>拖动层</title>
</head>
<script language="javascript" >
var Browser_Name=navigator.appName;
var is_IE=(Browser_Name=="Microsoft Internet Explorer");
var x=0,y=0,x1=0,y1=0,xx=0,yy=0,xx1=0,yy1=0;
var moveable=false;
var index=10000;
var resizeable=false;
//开始拖动
function startDrag(obj,evt)
e=evt?evt:window.event;
if(true)
if (!window.captureEvents)
obj.setCapture();
else
window.captureEvents(Event.MOUSEMOVE|Event.MOUSEUP);
var win=obj.parentNode;//取得父窗体
win.style.zIndex=++index;//设置父窗体的Z轴值
x= e.clientX;//取得当前鼠标的X坐标
y= e.clientY;//取得当前鼠标的Y坐标
x1 = parseInt(win.style.left);//将父窗体的距浏览器左边界的距离转换为NUMBER
y1 = parseInt(win.style.top);//将父窗体的距浏览器上边界的距离转换为NUMBER
moveable=true;
function drag(evt)
e=evt?evt:window.event;
if(moveable)
var win=document.getElementById ("dialogbox");
win.style.left =x1+e.clientX-x;
win.style.top =y1+e.clientY-y;
//停止拖动
function stopDrag(event)
var obj=document.getElementById ("title");
if(moveable)
if (is_IE)
obj.releaseCapture();
else
e.preventDefault();
document.addEventListener("mouseup",stopDrag,true);
document.addEventListener("mousemove",drag, true);
moveable = false;
function Resizing(evt)
var e= evt ?evt: window.event;
if(resizeable)
var win=document.getElementById ("dialogbox");
win.style.width = x1+ e.screenX-x;
win.style.height =y1+ e.screenY-y;
//停止缩放
function stopResize(evt)
var obj=document.getElementById ("border");
if(resizeable)
if (is_IE)
obj.releaseCapture();
else
document.removeEventListener("mouseup",stopResize,true);
document.removeEventListener("mousemove",Resizing,true);
resizeable = false;
//开始缩放
function startResize (obj,evt)
var e=evt;
if (is_IE)
obj.setCapture();
else
e.preventDefault();
document.addEventListener("mouseup",stopResize,true);
document.addEventListener("mousemove",Resizing,true);
var win=obj.parentNode;//取得父窗体
win.style.zIndex=++index;//设置父窗体的Z轴值
x= e.screenX;//clientX;//取得当前鼠标的X坐标
y= e.screenY;//clientY;//取得当前鼠标的Y坐标
x1 = parseInt(win.style.width);
y1 = parseInt(win.style.height);
resizeable=true;
</script>
<body >
<div id="dialogbox" style="position:absolute; width:200px; height:200px; background-color:#99CCFF; z-index:200; top:100px; left:50px;">
<div id="title" onMouseDown="startDrag(this,event)" onMouseMove="drag(event)" onMouseUp="stopDrag(event)" style="width:100%; height:20px; background-color:#330033; top:0px; left:0px; z-index:200; position:absolute; font-size:9pt; color:#FFFFFF; padding-top:5px; padding-left:5px;">浮动窗口</div>
<div id="border" style="width:5px; height:100%; background-color:#00dd00; top:20px; left:150px; z-index:150; float:right;position:related;cursor:e-resize; " onMouseDown="startResize(this,event)" onMouseMove="Resizing(event)" onMouseUp="stopResize(event)"></div>
</div>
</body>
</html>本回答被提问者采纳
arcmap图层缩放到一定比例后就看不到了
如图:
当缩放后:
就看不到图了,但是图层显示是“可见”
你可以右键图层,选择“属性”,点击“基本”或类似的标签(我使用的是英文版,标签是general),里面有图层的显示比例尺范围,看看是不是设置对了。如果30w的比例尺没在你设置的范围内,那就应该是不可见的
以上是关于javascript 层缩放问题(望得贵人帮忙)解决问题再加分,谢谢!的主要内容,如果未能解决你的问题,请参考以下文章