日期:2014-05-16  浏览次数:20449 次

层的拖动问题
如何实现层的拖动,类似“3721”的效果,拖动后其它的层能够换位置。
谢谢!

------解决方案--------------------
这里有一个我写的例子,自己看吧

<style type= "text/css ">
body{
margin:0;
padding:10px;
}
div.big {
border:solid 1px #999999;
clear:both;
width:500px;
height:150px;
margin:0 0 10px 0;
}
div.small {
border:solid 1px #999999;
float:left;
width:245px;
height:50px;
margin:0 10px 10px 0;
}
div.miniroom {
border:solid 1px #999999;
clear:both;
width:500px;
height:200px;
margin:0 0 10px 0;
}
div.dragger {
position:absolute;
z-index:999;
filter:alpha(Opacity=80);
background:gray;
}

div#container {
width:530px;
padding:0px;
}

div.floatleft{
float:left;
}
div.floatright{
float:right;
}
</style>
<body>
<div id= "container " style= "width:800px ">
<div id= "smallcolumn " class= "floatleft " style= "width:250px ">
<div id= "sample5 " class= "small " style= "background:green;height:300px ">
用户信息 </div>
<div id= "sample6 " class= "small " style= "background:brown ">
知己关系 </div>
<div id= "sample7 " class= "small " style= "background:orange ">
最新访客 </div>
</div>
<div id= "bigcolumn " class= "floatleft " style= "width:530px ">
<div id= "sample1 " class= "big " style= "background:red ">
封面故事 </div>
<div id= "sample2 " class= "miniroom " style= "background:gray ">
miniroom </div>
<div id= "sample3 " class= "small " style= "background:yellow ">
最新留言 </div>
<div id= "sample4 " class= "small " style= "background:blue ">
最新评论 </div>
</div>
</div>
<div style= "position:absolute;right:0;top:150px;width:200px;height:100px;border:solid 1px

black;padding:6px;background:white; ">
<label> 页面布局 </label> <hr size= "1 "/>
<input name= "position " type= "radio " value= "floatleft " onclick= "changePos(this.value) " /> 左小右大
<input name= "position " type= "radio " value= "floatright " onclick= "changePos(this.value) " /> 左大右小
</div>
</body>

<script type= "text/javascript ">
var currentPane = null;
function paneClass(id,source,container,isMiniroom){
this.id = id?id:null;
this.target = null;
this.source = null;
this.flagMoving = false;
this.isMiniroom = (isMiniroom == true)?true:false;
this.container = container;
this.classBig = "big ";
this.classSmall = "small ";
this.classFloatLeft = "floatleft ";
this.classMiniroom = "miniroom ";
this.initClass = source.className;
this.clickTime = 0;
this.initPane(source);
}

paneClass.prototype = {
initPane:function(source){
var temp = this;
this.paneHandler = source;
this.paneHandler.attachEvent( "onmousedown ",function(){return temp.start