请注意example2.html 在firefox下效果没有在ie下圆润,其原因来源于兼容性.
以及触发动作过快会导致每一个li递增两次到三次的情况,这个原因跟类(Action.js)本身无关.原因来源于example2.html中的演示代码.
目前正在极力修改中.
咨询改版升级信息请关注 我的blog
http://auntion.blogbus.com
或者加我QQ询问:82874972
action.js
/*
*
效果类
By Auntion
QQ:82874972
Blog:Auntion@blogbus.com
Email:Auntion@Gmail.com
版权没有,随便使用.
使用时请勿删除此部分注释.谢谢!
*
*/
ShowHide = Class.create();ShowHide.prototype = {status: expRs={},initialize: function(ob,endW,endH,effect,step){this.element=(typeof(ob)=='object') ? ob : $id(ob);if(expRs[ob.id]==null){ expRs[ob.id] = true; }if(expRs[ob.id]){this.width=this.element.offsetWidth;this.height=this.element.offsetHeight;this.endW=(endW != null)?endW.isZero():null;this.endH=(endH != null) ? endH.isZero():null;this.effect=(effect!=null)?effect:0;this.step=(step!=null)?step:0.075;this.now=[0,0];this.tryBug=this.step;this.method,this.goTo;expRs[this.element.id]=false;this.start();}},start: function(){switch(this.effect){case 0:{var method = this.judgment();this.base(method);}break;case 1:{var method = this.judgment();this.alpha(method);}break;default:{alert("错误: 不是一个可用的效果! 应为0和1,默认执行0");var method = this.judgment();this.base(method);}}},base: function(method){this.element.style.overflow = "hidden";this.goTo = this.create(method);},alpha: function(method,step,Opacity){alert("未完成的效果,自动用默认效果替代.");this.goTo = this.base(method);},allIs: function(){this.now[0] += this.expressions(0,this.endW,this.now[0],this.step);this.now[1] += this.expressions(0,this.endH,this.now[1],this.step);if((this.width > this.endW) ? (this.now[0] > (this.endW+this.tryBug)) : (this.now[0] this.endH)? (this.now[1] > (this.endH+this.tryBug)) : (this.now[1] this.endW) ? (this.now > (this.endW+this.tryBug)) : (this.now this.endH) ? (this.now > (this.endH+this.tryBug)) : (this.now
language.js
/*
*
语言扩展包
By Auntion
QQ:82874972
Blog:Auntion@blogbus.com
Email:Auntion@Gmail.com
版权没有,随便使用.
使用时请勿删除此部分注释.谢谢!
*
*/
var Class={create: function() {return function() {this.initialize.apply(this, arguments);}}};$id = function(i){return document.getElementById(i);};$name = function(i){return document.getElementsByName(i);};$class = function(className,baseId) {var fatherId = null;if(!baseId){fatherId = document;}else{var id = baseId;fatherId = $id(id);}var basic = fatherId.getElementsByTagName('*') || document.all;var child = null;var classNames = null;var aggregate = []; for (var i = 0; i
example.html
nbsp;html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
example1 <script></script>
<script></script>
- 恢复初始值
- 隐藏
- 宽 + 30
- 高 + 30
- 宽 - 30
- 高 - 30
- 宽600,高100
|
<script> <BR>var element = $id("demo"); <br><br>var width = element.offsetWidth; <BR>var height= element.offsetHeight; <br><br>alert(width) <br><br>var step = 0.115 <br><br>function now(){ <BR> this.nowWidth = element.style.width.toInt(); <BR> this.nowHeight= element.style.height.toInt(); <BR>} <br><br> $id("a").onmousedown = function(){ <br><br> new ShowHide(element,width,height,0,step); <br><br> } <br><br> $id("b").onmousedown = function(){ <br><br> new ShowHide(element,0,0,0,step); <br><br> } <br><br> $id("c").onmousedown = function(){ <br><br> var test = new now(); <BR> new ShowHide(element,test.nowWidth+30,null,0,step); <br><br> } <br><br> $id("d").onmousedown = function(){ <br><br> var test = new now(); <BR> new ShowHide(element,null,test.nowHeight+30,0,step); <br><br> } <br><br> $id("e").onmousedown = function(){ <br><br> var test = new now(); <BR> new ShowHide(element,test.nowWidth-30,null,0,step); <br><br> } <br><br> $id("f").onmousedown = function(){ <br><br> var test = new now(); <BR> new ShowHide(element,null,test.nowHeight-30,0,step); <br><br> } <br><br> $id("i").onmousedown = function(){ <br><br> new ShowHide(element,600,100,0,step) <br><br> } <BR></script>