问题描述
添加分屏功能,公聊跟私聊分屏显示,一般分屏用的都是frame,我想只用2个Div应该怎样实现,主要是分屏后两个Div中间加个什么可以拖动控制2个div的高度.高手帮忙解答,谢谢了!
解决方案
解决方案二:
<style>div{width:100px;height:100px;left:100px;top:100px;position:absolute;border:1pxsolidgray;overflow:hidden}.dragAble{position:relative;cursor:move;}</style><bodyonload=makeResizable(odiv1);makeResizable(odiv2);><divid=odiv1></div><divid=odiv2style="left:300px"class="dragAble"></div></body><script>functionmakeResizable(obj){vard=5;varl,t,r,b,ex,ey,cur;obj.attachEvent("onmousedown",mdown);obj.attachEvent("onmouseup",mup);obj.attachEvent("onmousemove",mmove);functionmdown(){if(event.button==1&&obj.style.cursor){obj.resizing=true;obj.setCapture();}}functionmup(){if(event.button==1&&obj.resizing){obj.resizing=false;obj.releaseCapture();}}functionmmove(){if(obj.resizing){vardx=event.screenX-ex;vardy=event.screenY-ey;if(cur.indexOf("w")>-1)l+=dx;elseif(cur.indexOf("e")>-1)r+=dx;if(cur.indexOf("n")>-1)t+=dy;elseif(cur.indexOf("s")>-1)b+=dy;vars=obj.style;if(r-l>2*d){s.left=l;s.width=r-l;}if(b-t>2*d){s.top=t;s.height=b-t;}ex+=dx;ey+=dy;}elseif(event.srcElement==obj){varx=event.offsetX,y=event.offsetY;varc=obj.currentStyle;w=parseInt(c.width),h=parseInt(c.height);cur=y<d?"n":h-y<d?"s":"";cur+=x<d?"w":w-x<d?"e":"";if(cur){obj.style.cursor=cur+"-resize";l=parseInt(c.left);t=parseInt(c.top);r=l+w;b=t+h;ex=event.screenX;ey=event.screenY;}elseif(obj.style.cursor)obj.style.cursor="";}}}</script>