Firefox에서 example2.html의 효과는 IE에서만큼 원활하지 않습니다. 그 이유는
너무 빠른 트리거 작업으로 인해 각 li이 2~3배 증가하게 됩니다. 이유는 클래스(Action.js) 자체와는 아무런 관련이 없습니다. 이유는 example2.html의 데모 코드에서 비롯됩니다.
현재 수정 중입니다.
수정 및 업그레이드에 대한 내용입니다. , 제 블로그
http://auntion.blogbus.com
을 팔로우하시거나 QQ에 저를 추가해 문의해주세요: 82874972
action.js
/*
*
效果类
아줌마님
QQ:82874972
블로그:Auntion@blogbus.com
이메일:Auntion@Gmail.com
版权没有,随便使用.
使用时请勿删除此part分注释.谢谢!
*
*/
ShowHide = Class.create();ShowHide.prototype = {status: expRs={},initialize: function(ob,endW,endH ,효과,단계){this.element=(typeof(ob)=='객체') ? 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.효과=(효과!=null)?효과: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.효과){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.endW-this.tryBug))){this.element.style.width = this.now[0] "px";}if( (this.height > this.endH)? (this.now[1] > (this.endH this.tryBug)) : (this.now[1] < (this.endH-this.tryBug))){this.element.style.height= this.now[1] "px";} else{clearInterval(this.goTo);this.element.style.width = (this.now[0] this.tryBug) "px";this.element.style.height=(this.now[1] this.tryBug ) "px";expRs[this.element.id] = true;}},widthIs: function(){this.now = this.expressions(0,this.endW,this.now,this.step);if( (this.width > this.endW) ? (this.now > (this.endW this.tryBug)) : (this.now <(this.endW-this.tryBug))){this.element.style .width = this.now "px";}else{clearInterval(this.goTo);this.element.style.width = (this.now this.tryBug) "px";expRs[this.element.id] = true ;}},heightIs: function(){this.now = this.expressions(0,this.endH,this.now,this.step);if((this.height > this.endH) ? (this.now > (this.endH this.tryBug)) : (this.now <(this.endH-this.tryBug))){this.element.style.height = this.now "px";}else{clearInterval( this.goTo);this.element.style.height = (this.now this.tryBug) "px";expRs[this.element.id] = true;}},judgment: function(){if(this.endW != null && this.endH !=null){this.method = "all";this.now = [this.width,this.height];}else if(this.endW != null && this.endH == null){this.method = "width";this.now = this.width;}else if(this.endW == null && this.endH != null){this.method = "height";this.now = this.높이; }return this.method;},create: function(codeString){var ShowHideGoTo;switch(codeString){case "all" : ShowHideGoTo = setInterval(function(){this.allIs();}.bind(this),1 );부서지다; 사례 "너비" : ShowHideGoTo = setInterval(function(){this.widthIs();}.bind(this),1);break;case "높이": ShowHideGoTo = setInterval(function(){this.heightIs(); }.bind(this),1);break;}return ShowHideGoTo;}, 표현식: function(num,end,now,step){var exec;switch(num){ case 0 : exec =(end - now)* 단계; 휴식; 기본값 : exec =(끝 - 지금)*step;break;}return exec;}};
언어.js
/*
*
언어 확장팩
By Auntion
QQ:82874972
Blog:Auntion@blogbus.com
Email:Auntion@Gmail.com
저작권은 없으니 마음껏 사용하세요.
댓글 사용시 이 부분은 삭제하지 마세요.
*
*/
var Class={create: function() {return function() {this.initialize.apply(this, 인수);}} };$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;varaggregate = []; for (var i = 0; i < basic.length; i ) {child = basic[i];classNames = child.className.split(' ');for (var j = 0; j < ; classNames.length; j ) {if (classNames[j] == className) {aggregate.push(child);break;}}}return Aggregate;};String.prototype.toInt = function(){returnparseInt(this .replace(/[a-zA-Z] /,''));};Number.prototype.isZero = function(){return (this < 0) ? };Function.prototype.bind = function(e) {var md = this;return function(){return md.apply(e,arguments);}};Object.prototype.attachEvent=function(method,func){if (!this[메서드]) this [메서드]=func;else this[메서드]=this[메서드].attach(func);};Function.prototype.attach=function(func){var f=this;return 함수 (){f();func ();}};
example.html