网站常用窗口拖拽特效,鼠标压住边角拖动放大或者缩小,这个窗口拖动特效兼容性不错的。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html;charset=gb2312"> <meta name="keywords" content="武鸣人网站,武鸣信息网,武鸣本地网,武鸣信息资源平台,减肥,健身,励志,励志语录,js特效,网页特效,www.wuming.ren"> <meta name="description" content="欢迎来到武鸣人信息资源平台,各种信息免费发布,资源共享合作共赢,分享互联网流行的励志语录经典短句,减肥健身健康小常识及打卡记录,收集各种js特效代码。"> <title>兼容性很好的拖拽窗口放大缩小特效_武鸣人</title> <style type="text/css"> *{margin:0;padding:0;} #www_wuming_ren{ width:100%; height:100%; background:#f00; filter:alpha(opacity:0); opacity:0; z-index:9999; position:absolute; top:0; left:0; display:none; } #wuming_ren_2{ width:200px; height:200px; position:relative; background:#EEEEEE; border:1px solid #f00; } #www_wuming_ren_1{ width:15px; height:15px; background:#99CC00; position:absolute; right:0px; bottom:0px; cursor:nw-resize; overflow:hidden; font-size:12px; text-align:center; line-height:15px; color:#FFFFFF; float:right; z-index:3; } #right{ width:15px; height:100%; background:#f00; float:right; position:absolute; right:0; top:0; cursor:e-resize; overflow:hidden; filter:alpha(opacity:0); opacity:0; z-index:1; } #bottom{ width:100%; height:15px; background:#f00; position:absolute; left:0; bottom:0; cursor:n-resize; overflow:hidden; filter:alpha(opacity:0); opacity:0; z-index:1; } #wuming_ren_2 p{ padding:10px; line-height:24px; font-size:13px; text-indent:24px; color:#996600; } #wuming_ren_2 h2{ width:100%; height:25px; line-height:25px; font-size:14px; background:#CC9900; color:#FFFFFF; text-indent:15px; cursor:move; overflow:hidden; } </style> <script type="text/javascript"> window.onload=function() {//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀) var oDiv=document.getElementById("www_wuming_ren_1"); var oDiv2=document.getElementById("wuming_ren_2"); var zhezhao=document.getElementById("www_wuming_ren"); var h2=oDiv2.getElementsByTagName("h2")[0]; var right=document.getElementById("right"); var bottom=document.getElementById("bottom"); var mouseStart={}; var divStart={}; var rightStart={}; var bottomStart={}; //往右拽 right.onmousedown=function(ev) { var oEvent=ev||event; mouseStart.x=oEvent.clientX; mouseStart.y=oEvent.clientY; rightStart.x=right.offsetLeft; if(right.setCapture) { right.onmousemove=doDrag1; right.onmouseup=stopDrag1; right.setCapture(); } else { document.addEventListener("mousemove",doDrag1,true); document.addEventListener("mouseup",stopDrag1,true); } }; function doDrag1(ev) { var oEvent=ev||event; var l=oEvent.clientX-mouseStart.x+rightStart.x; var w=l+oDiv.offsetWidth; if(w<oDiv.offsetWidth) { w=oDiv.offsetWidth; } else if(w>document.documentElement.clientWidth-oDiv2.offsetLeft) { w=document.documentElement.clientWidth-oDiv2.offsetLeft-2; } oDiv2.style.width=w+"px"; }; function stopDrag1() { if(right.releaseCapture) { right.onmousemove=null; right.onmouseup=null; right.releaseCapture(); } else { document.removeEventListener("mousemove",doDrag1,true); document.removeEventListener("mouseup",stopDrag1,true); } }; //往下拽 bottom.onmousedown=function(ev) { var oEvent=ev||event; mouseStart.x=oEvent.clientX; mouseStart.y=oEvent.clientY; bottomStart.y=bottom.offsetTop; if(bottom.setCapture) { bottom.onmousemove=doDrag2; bottom.onmouseup=stopDrag2; bottom.setCapture(); } else { document.addEventListener("mousemove",doDrag2,true); document.addEventListener("mouseup",stopDrag2,true); } }; function doDrag2(ev) { var oEvent=ev||event; var t=oEvent.clientY-mouseStart.y+bottomStart.y; var h=t+oDiv.offsetHeight; if(h<oDiv.offsetHeight) { h=oDiv.offsetHeight; } else if(h>document.documentElement.clientHeight-oDiv2.offsetTop) { h=document.documentElement.clientHeight-oDiv2.offsetTop-2; } oDiv2.style.height=h+"px"; }; function stopDrag2() { if(bottom.releaseCapture) { bottom.onmousemove=null; bottom.onmouseup=null; bottom.releaseCapture(); } else { document.removeEventListener("mousemove",doDrag2,true); document.removeEventListener("mouseup",stopDrag2,true); } }; //往左右同时拽 oDiv.onmousedown=function(ev) { var oEvent=ev||event; mouseStart.x=oEvent.clientX; mouseStart.y=oEvent.clientY; divStart.x=oDiv.offsetLeft; divStart.y=oDiv.offsetTop; if(oDiv.setCapture) { oDiv.onmousemove=doDrag; oDiv.onmouseup=stopDrag; oDiv.setCapture(); } else { document.addEventListener("mousemove",doDrag,true); document.addEventListener("mouseup",stopDrag,true); } zhezhao.style.display='block'; }; function doDrag(ev) { var oEvent=ev||event; var l=oEvent.clientX-mouseStart.x+divStart.x; var t=oEvent.clientY-mouseStart.y+divStart.y; var w=l+oDiv.offsetWidth; var h=t+oDiv.offsetHeight; if(w<oDiv.offsetWidth) { w=oDiv.offsetWidth; } else if(w>document.documentElement.clientWidth-oDiv2.offsetLeft) { w=document.documentElement.clientWidth-oDiv2.offsetLeft-2; } if(h<oDiv.offsetHeight) { h=oDiv.offsetHeight; } else if(h>document.documentElement.clientHeight-oDiv2.offsetTop) { h=document.documentElement.clientHeight-oDiv2.offsetTop-2; } oDiv2.style.width=w+"px"; oDiv2.style.height=h+"px"; }; function stopDrag() { if(oDiv.releaseCapture) { oDiv.onmousemove=null; oDiv.onmouseup=null; oDiv.releaseCapture(); } else { document.removeEventListener("mousemove",doDrag,true); document.removeEventListener("mouseup",stopDrag,true); } zhezhao.style.display='none'; }; //h2完美拖拽 h2.onmousedown=function(ev) { var oEvent=ev||event; mouseStart.x=oEvent.clientX; mouseStart.y=oEvent.clientY; divStart.x=oDiv2.offsetLeft; divStart.y=oDiv2.offsetTop; if(h2.setCapture) { h2.onmousemove=doDrag3; h2.onmouseup=stopDrag3; h2.setCapture(); } else { document.addEventListener("mousemove",doDrag3,true); document.addEventListener("mouseup",stopDrag3,true); } zhezhao.style.display='block'; }; function doDrag3(ev) { var oEvent=ev||event; var l=oEvent.clientX-mouseStart.x+divStart.x; var t=oEvent.clientY-mouseStart.y+divStart.y; if(l<0) { l=0; } else if(l>document.documentElement.clientWidth-oDiv2.offsetWidth) { l=document.documentElement.clientWidth-oDiv2.offsetWidth; } if(t<0) { t=0; } else if(t>document.documentElement.clientHeight-oDiv2.offsetHeight) { t=document.documentElement.clientHeight-oDiv2.offsetHeight; } oDiv2.style.left=l+"px"; oDiv2.style.top=t+"px"; };//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀) function stopDrag3() { if(h2.releaseCapture) { h2.onmousemove=null; h2.onmouseup=null; h2.releaseCapture(); } else { document.removeEventListener("mousemove",doDrag3,true); document.removeEventListener("mouseup",stopDrag3,true); } zhezhao.style.display='none'; } };//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀) </script> </head> <body> <a href="https://www.wuming.ren">武鸣人</a>,各种信息资源免费发布,分享励志语录经典短句,减肥健身常识,各种js特效代码。网站很好记住,wuming.ren(武鸣拼音.ren域名后缀)<hr> <!--欢迎来到武鸣人信息资源平台,各种信息免费发布,资源共享合作共赢,分享互联网流行的励志语录经典短句,减肥健身健康小常识及打卡记录,收集各种js特效代码。--> <script type="text/javascript" src="https://www.wuming.ren/ad/tc.js"></script> <script type="text/javascript" src="https://www.wuming.ren/ad/a.js"></script> <div id="wuming_ren_2"> <div style="width:100%;height:100%;overflow:hidden;"> <h2>武鸣人拖拽特效</h2> <p>记录日常生活点滴,努力是一种状态,与年龄无关,越努力越幸运,越自律越优秀,所有优秀背后都是苦行僧般的自律!觉得好下次再来,或者推荐给您身边需要的朋友!</p> <div id="right"></div> <div id="www_wuming_ren_1">拖</div> <div id="bottom"></div> </div> </div> <div id="www_wuming_ren"></div> </body> </html>
本文来自武鸣人网站,转载请注明出处