爱易网
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 浏览次数:20243 次
以下是程序代码
<!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;
上一篇:狡猾的按钮特效
下一篇:网页顶部弹出可关闭广告图层
免责声明:
本文仅代表作者个人观点,与爱易网无关。其原创性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容、文字的真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
相关资料
更多>
传360周鸿祎曾试图阻止百度收购91无线
只有切到刚需痛点,漫画APP才能走下去
奇虎360证明了“惟平台化才能生存”是谬论,中国互联网不能少了周鸿祎
迪信通神秘免费服务揭谜底:充电宝免费带回家
英特尔涉嫌垄断 欧盟或开出史上最高罚单
腾讯为何在与阿里百度的收购比赛中当看客?
惠普董事长莱恩辞职 为巨额财务减记埋单
美图手机2问世 三大问题令其市场销量堪忧
HTC与苹果三星距离扩展 C2B形式成新武器
推荐阅读
更多>
一大波智能路由器正在袭来:小米、360、极路由大PK
三问刘强东:京东为何近来火气这么大?
诺基亚仍是第二大手机商:功用机有利可图
墨迹也要做硬件,工具类应用如何“变异”的
看蜗牛如何放水养鱼,盘活生态系统
工信部或本月17日向联通电信颁发FDD牌照
“世界杯+618”集体磨刀的本质是绑架全民
二维码支付大战的号角注定已经吹响,尚需标准发放
湖南卫视扶持芒果TV杀入媒体:版权独播不分销
马云:银行若放开存款利率 余额宝死了也光荣
团购网站存活率仅18.6% 剩余缺乏千家
云智慧:用大数据实现企业应用性能管理
国美苏宁线上首度正面PK 京东列席4月电商战
新浪微博推粉丝头条功能 意欲与大号分成
途牛开盘价9美元 与发行价持平
八位知名设计师评iOS7:新鲜但复杂
NoomWeight减肥
北京电信推“0月租卡”,同网通话免费
代工厂生活危机:“富士康们”何去何从?
腾讯再次重申:普通微信誉户相对不收费