爱易网
IT新闻
IT新闻
爱易资讯
网站搭建
云虚拟主机教程
云服务器教程
Apache教程
IIS教程
Nginx教程
网站策划
站长文章
推广教程
淘宝客教程
网页设计
HTML教程
XHTML教程
CSS教程
HTML5教程
CSS3教程
JavaSript基础
JQuery教程
Node.js教程
前端技术
Ajax教程
Js特效
Xml教程
平面设计
页面UI设计
photoshop教程
程序开发
AI人工智能
Asp教程
Php教程
Asp.Net教程
Net Core教程
C#教程
Java教程
Jsp教程
开发技术
微信小程序教程
Uniapp开发教程
微信公众号开发
Andriod教程
IOS教程
DOS教程
Python教程
Docker教程
Windows Container教程
数据库
MSSQL教程
MySQL教程
Redis教程
Access教程
Oracle教程
数据库教程
操作系统
Linux教程
Windows教程
MAC教程
Cisco教程
交换机教程
防火墙教程
搜索
爱易网页
JS特效
可任意拖拽边框的图层特效 兼容所有浏览器
可任意拖拽边框的图层特效 兼容所有浏览器
日期:2014-05-18 浏览次数:20255 次
以下是程序代码
<!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" /> <title>爱易网网页特效演示兼容所有浏览器完美拖拽层</title> <style> *{margin:0;padding:0;} #zhezhao{ width:100%; height:100%; background:#f00; filter:alpha(opacity:0); opacity:0; z-index:9999; position:absolute; top:0; left:0; display:none; } #div2{ width:200px; height:200px; position:relative; background:#EEEEEE; border:1px solid #f00; } #div1{ 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; } #div2 p{ padding:10px; line-height:24px; font-size:13px; text-indent:24px; color:#996600; } #div2 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() { var oDiv=document.getElementById("div1"); var oDiv2=document.getElementById("div2"); var zhezhao=document.getElementById("zhezhao"); 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;
上一篇:狡猾的按钮特效
下一篇:网页顶部弹出可关闭广告图层
免责声明:
本文仅代表作者个人观点,与爱易网无关。其原创性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容、文字的真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
相关资料
更多>
2019双12阿里云老用户怎么参加拼团活动 老用户拼团方法
虚拟运营商们更像三大运营商的“二道贩子”
估值增长9.8% 阿里IPO前市值达2450亿美元
雅安地震 绝不宽恕应用人们爱心的骗子!
工商下月将整治手机市场
中电信率先推移动转售业务 中下旬批量上市
美图手机2问世 三大问题令其市场销量堪忧
苹果6月20日发布iPhone5S 触摸屏概念股生动
首家国有独资P2P平台上线 或预示政策日渐明朗
推荐阅读
更多>
搜房网遭遇做空 利益保送成“猎杀”焦点
Android版WhatsApp曝漏洞:聊天记录可被窃取
微软最后的救命稻草Win 8份额继续上升
戴尔新CEO名单曝光:惠普甲骨文高管在列
解读苹果收购Beats背后动机:库克在想什么?
固话上网卡或将实名制 运营商泄露用户信息将被罚
三星已经将Galaxy S5视为失败之作?
广电地方营业厅的一句“罚停”,暴露出了他们的本质
京东封杀财付通:终极目标是电商生态圈
曹国伟:微博将关注Facebook和Twitter
柳传志马云陷舆论漩涡:请不要辜负这个时代
摩托罗拉移动裁员关闭德州Moto X手机工厂
腾讯微信昨晚再现大规模故障 多地受到影响
首个释放出搅局房地产信号的互联网公司不是小米而是58同城
虚拟运营商流量不清零吸引用户 盈利待明
锐迪科将以9.25美元/ADS价钱出售835万份ADS
全球五大电信设备商业绩:华为净利居首
200美元英特尔Android笔记本行将到来
富士康欲用机器人产iPhone 6
乐视28日发布手机进展 LeUI系统Mobile版或曝光