爱易网
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 浏览次数:20241 次
以下是程序代码
<!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;
上一篇:狡猾的按钮特效
下一篇:网页顶部弹出可关闭广告图层
免责声明:
本文仅代表作者个人观点,与爱易网无关。其原创性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容、文字的真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
相关资料
更多>
中国移动承诺再降4G资费 网络漫游至50个国家
从百度世界大会看大数据
HTC与苹果三星距离扩展 C2B形式成新武器
中移动业绩增长趋缓 目光转向海外市场
支付宝27日晚间曝严重破绽:买卖记载可被搜索
永不磨灭的九大尖端编程语言
美国政府关门可能影响去哪儿等公司IPO
中国移动4G资费调整方案6月1日起正式实施
小米2S试水高端化 纯“性价比”玩法已成过去式
推荐阅读
更多>
说说这一个月的赌球输了多少
组建铁塔公司倒逼运营商改革 或加速4G网建设
200美元英特尔Android笔记本行将到来
中电信国际漫游费下调85% 世界杯上网28元/天
网络旅行游记被曝插入"软广告" 个别人士月入数万
国美痛批网购七宗罪 用短暂盈利输了未来
这一次,微软将带给我们什么惊喜?
微软提示XP只剩365天寿命:用户被绑架?
华为任正非:家族成员不会成为接班人
火一把就死: 百度魔图验证社交游戏衰亡宿命
中移动“重启”自有品牌手机成败难料
三星已经将Galaxy S5视为失败之作?
看,网络文学今日之繁盛;忆,纯真去哪了?
FDD牌照短期不会发放 联通电信暗自提速建网
诺基亚仍是第二大手机商:功用机有利可图
刘强东:京东上市融资用于开拓三至六线城市
刘强东向总理建言:打击有组织有规模的售假商家
眼球识别技术EyeVerify融资600万美元 360参投
王建宙解构OTT效劳 中移动重塑飞信平台
360涉足搜索范围 百度市场份额面临应战