爱易网
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特效
按钮操作图层js代码
按钮操作图层js代码
日期:2014-05-18 浏览次数:20247 次
以下是程序代码
<!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特效,js脚本,脚本,广告代码,zzjs,zzjs.net,www.zzjs.net,站长特效 网" /> <meta name="description" content="www.zzjs.net,站长特效网,站长必备js特效及广告代码。大量高质量js特效,提供高质量广告代码下载,尽在站长特效网" /> <title>网页特效 按钮操作图层 站长特效网欢迎您。</title> <style type="text/css"> body{margin:0;} body,td{font-size:12px;} </style> <script language="javascript"> function addload(func){ window.attachEvent ? window.attachEvent("onload", func) : window.addEventListener("load", func, false); } /* animr(id, attr, ol, al, bfunc, afunc) id 对象(string|object) attr 动画方式(string|number)(width:1, height:2, left:3, top:4, opac:5) ol 原始状态(number)(-1:使用当前状态不累加, 0:使用当前状态且累加最终状态, >0:固定某状态) al 最终状态(number) bfunc 动画前的动作(function) afunc 动画后的动作(function) *///欢迎来到站长特效网,我们的网址是www.zzjs.net,很好记,zz站长,js就是js特效,本站收集大量高质量js代码,还有许多广告代码下载。 function animr(){ var id = typeof arguments[0] == "string" ? document.getElementById(arguments[0]) : arguments[0]; if(!id){alert(arguments[0] + " 初始化错误\n请检查ID是否正确!");return;} var cie = window.ActiveXObject, step = 15, //递增量,数值越大缓冲效果越明显 attrs = {"width":1, "height":2, "left":3, "top":4, "opac":5}, attr = typeof arguments[1] == "string" ? attrs[arguments[1].toLowerCase()] : arguments[1]; if(attr==undefined||attr>5||parseInt(attr)!=attr){alert("动画方式设置错误!");return;} //动画方式 var ol = typeof arguments[2] == "number" ? arguments[2] : null, //原始状态 al = typeof arguments[3] == "number" ? arguments[3] : null; //最终状态 if(ol == null||al == null) return; var bfunc = arguments[4], //动画前的动作 afunc = arguments[5], //动画后的动作 _id = id, _ol = ol, _al = al, offset = function(obj){ //获取当前绝对状态 var x = obj.offsetLeft, y = obj.offsetTop, w = obj.offsetWidth, h = obj.offsetHeight; while(obj=obj.offsetParent){x+=obj.offsetLeft; y+=obj.offsetTop;} return{"x":x, "y":y, "w":w, "h":h} }; if(!id.effect){ id.effect = {}; id.effect.width = 0; id.effect.height = 0; id.effect.left = 0; id.effect.top = 0; id.effect.opac = 0; }; if(bfunc) bfunc(); switch(attr){ case 1: clearInterval(id.effect.width); if(_ol==0||_ol==-1) ol = offset(_id).w; var gattr = id.getAttribute("owidth"); if(!gattr&&_ol==-1) id.setAttribute("owidth",ol); id.style.width = gattr ? gattr + "px" : ol + "px"; if(_ol==0||_ol==-1) al += parseInt(id.style.width); if(al<0) al = 0; id.style.overflow = "hidden"; id.effect.width = setInterval(function(){ var il = parseInt(id.style.width); if(_al>=0){ if(il<al){ id.style.width = (il+Math.ceil((al-il)/step)) + "px"; }else{ clears(); } }else{ if(il>al){ id.style.width = (il-Math.ceil((il-al)/step)) + "px"; }else{ clears(); } } }, 1); var clears = function(){ id.style.width = al + "px"; clearInterval(id.effect.width); if(afunc) afunc(); }; break; case 2: clearInterval(id.effect.height); if(_ol==0||_ol==-1) ol = offset(_id).h; var gattr = id.getAttribute("oheight"); if(!gattr&&_ol==-1) id.setAttribute("oheight",ol); id.style.height = gattr ? gattr + "px" : ol
上一篇:狡猾的按钮特效
下一篇:按钮控制图层旋转特效
免责声明:
本文仅代表作者个人观点,与爱易网无关。其原创性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容、文字的真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
相关资料
更多>
雷军会做赔钱生意?迅雷跌破发行价 市值仅7亿美元
电信设备商淘金中国4G:华为中兴领衔
继续涨:微博IPO第二交易日 收盘大涨11.71%
同为70前后人,马云为什么总是像外星人那么瘦
云智慧:用大数据实现企业应用性能管理
虚拟运营商们更像三大运营商的“二道贩子”
百度对糯米来说到底意味着什么?
携程整合去哪儿陷入僵局 欲联手老对手艺龙
优酷土豆兼并一年:依然处于烧钱形状
推荐阅读
更多>
打车App就是下一个团购骗局!?
百视通:Xbox One汉化获批 游戏迷欢呼吧
组建铁塔公司倒逼运营商改革 或加速4G网建设
孙正义入股阿里往事还原:阿里巴巴并非软银首选
中移动一季度净利大降:手机补贴增长过快
黑狐病毒疯传播 电脑管家首推 专杀工具
网络文学竞争白热化 百度多酷文学网上线
雅安地震 绝不宽恕应用人们爱心的骗子!
中移动落马高管盘点:广东移动成反腐重地
高通反垄断案下月有望落定
HTC以品牌营销突围 专家建议改变经营思路
IT时代周刊总编辑曹健:投资人刘志硕印象记
公信力消失:马航事件社交媒体传播之痛
永不磨灭的九大尖端编程语言
传诺基亚5月14日发布会推出Lumia 950
网曝富士康500万iphone遭退货是确证的事
虚拟运营商们更像三大运营商的“二道贩子”
阿里巴巴IPO难掩的四个现实问题:天猫销售额成谜、淘宝拖后腿、营收迅猛其他不行和投资者未必买账
三大运营商获通知大减营销费 传3年减400多亿
优酷土豆携手新浪微博 谋攻移动视频失地