js實現拉伸拖動iframe

2021-06-14 10:34:14 字數 2031 閱讀 4112

左邊iframe放樹目錄,右邊的iframe放index頁。拖滑鼠同時控制2個iframe的寬高。

期待有人能改進。

操作方法:滑鼠指到2個iframe中間,可以水平拖,縱向拖(控制高度)

缺點:csdn頁面放開滑鼠後才改大小,不佔cpu資源。 這個是實時改大小,所以速度太慢,希望有人來改改。我是不想弄了,反正又沒用什麼特別的技術。

修改一:

var isresizing=false;

function resize_mousedown(event,obj)

function resize_mousemove(event,obj)

function resize_mouseup(event,obj)

< /script>

< body style='margin:0' >

< table style="width:100%;height:100%;" border=0 cellspacing=0 cellpadding=0px >

< tr>

< td style="width:150px;">

< iframe zindex=1 id="a" src="" style="width:100%;height:100%;z-index:9 ">

< /td>

< td style="width:2px;cursor:e-resize;background-color:#cccccc;" οnmοusedοwn="resize_mousedown(event,this);"

οnmοuseup="resize_mouseup(event,this);" οnmοusemοve="resize_mousemove(event,this);">

< /td>

< td>

< iframe zindex=1 id="b" name="contentframe" src="" style="width:100%;height:100%;z-index:10">

< /td>

< /tr>

< /table>

< /body>

修改二:

var isresizing=false;

function resize_mousedown(event,obj)

function resize_mousemove(event,obj)

function resize_mouseup(event,obj)

function resize_setdefault(event,obj)

else

event.cancelbubble=true;

}< /script>

< body style='margin:0' >

< table style="width:100%;height:100%;" border=0 cellspacing=0 cellpadding=0px >

< tr>

< td style="width:150px;" >

< iframe zindex=1 id="a" src="" style="width:100%;height:100%;z-index:9 ">

< /td>

< td style="width:3px;cursor:e-resize;background-color:#cccccc;" align="center" valign="middle"

οnmοusedοwn="resize_mousedown(event,this);" οnmοuseup="resize_mouseup(event,this);" οnmοusemοve="resize_mousemove(event,this);">

<

< /td>

< td>

< iframe zindex=1 id="b" name="contentframe" src="" style="width:100%;height:100%;z-index:10">

< /td>

< /tr>

< /table>

< /body>

JS實現DIV拖動

可移動可調整大小 預設居中開啟 保留位置上開啟 開啟div 操作說明 選中核取方塊 可移動 可調整大小 後,開啟的div具有移動 調整大小的功能 此時移動 調整大小快捷鍵可使用 反之,不可移動 調整大小 此時移動 調整大小快捷鍵無效 單選框預設居中開啟選中,無論有無儲存div位置和大小均以預設位置及...

JS實現拖動div層移動

js實現拖動div層移動 在談到拖動div層之前,我們有必要來了解下 下面js幾個屬性的區別 pagex,pagey,layerx,layery,clientx,clienty,screenx,screeny,offsetx之間的區別!pagex 滑鼠在頁面上的位置,從頁面左上角開始,即是以頁面為參...

原生js實現模態框拖動

由於本人水平有限,不足之處請大佬指出!1.引入reset.css 2.編寫html檔案 控制內容的高度 確認修改 注意 內容的高度相對於頭部和頂部的份數 顯示模態框 x3.編寫index.css檔案 body drag drag drag header drag drag body drag dra...