爱易网
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 浏览次数:20212 次
以下是程序代码
<!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;
上一篇:狡猾的按钮特效
下一篇:网页顶部弹出可关闭广告图层
免责声明:
本文仅代表作者个人观点,与爱易网无关。其原创性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容、文字的真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
相关资料
更多>
携程艺龙联手死磕同程 价钱烽烟蔓延至机票
移动联通回应税率改革:短期内收入利润将大减
568倍PE,“长跑者”亚马逊的高估值之谜
弯曲变形:手机全新的交互方式
罗永浩工匠形象坍塌,锤子产能再跳水逃离用户超两成
云智慧:用大数据实现企业应用性能管理
新浪微博推粉丝头条功能 意欲与大号分成
国网公司将加快组建 业界人士称困难重重
靠价格战赚取资费套餐利润差,虚拟运营商必死无疑
推荐阅读
更多>
中国雅虎邮箱今日关停 由盛及衰的背后
PC迎9年来出货量新低 平板电脑渐成主流
途牛旅游网今晚挂牌纳斯达克 融资1亿美元
网易微博将正式关闭 用户迁至轻博客LOFTER
开个房刷个卡全世界都知道个人隐私成公开秘密
索尼移动中国区陷裁员风波:业务不佳 员工焦虑
虚拟运营商前路迷茫 业界建议发力车联网
微软大幅调整Bing在华策略:从高大上到接地气
国美在线叫板京东:李俊涛底气在哪?
苹果已经允许开发者提交64位应用程序
高通拼抢国际芯片市场 联发科海外拓展难安心
北京电信推“0月租卡”,同网通话免费
阿里物流搭上邮政:京东,我们在终点等你!
200美元英特尔Android笔记本行将到来
中移动业绩增长趋缓 目光转向海外市场
谷歌新技术进入iOS平台:将叫板苹果Siri
支付宝27日晚间曝严重破绽:买卖记载可被搜索
解析2014年阿里百度等五大互联网巨头深度布局
奇虎360证明了“惟平台化才能生存”是谬论,中国互联网不能少了周鸿祎
云储存有多远:跨过数据安全问题即可到达