var isIE = () ? true : false;
var $ = function (id) {
return "string" == typeof id ? (id) : id;
};
if(!isIE){
.__defineGetter__("currentStyle", function () {
return (this, null);
});
}
var Class = {
create: function() {
return function() {
(this, arguments);
}
}
}
= function(destination, source) {
for (var property in source) {
destination[property] = source[property];
}
return destination;
}
var FadeStruct = function(options){
= false;//Is it gradient
= 0;//start value
= 0;//end value
= 0;//Target value
(this, options || {});
}
var Fade = ();
= {
initialize: function(obj, options) {
var obj = $(obj);
= "hidden";
this._obj = obj;
this._timer = null;//Timer
this._finish = true;//Is the execution completed
this._fun = function(){};//Gradar program
this._x = this._y = 0;//Transform point position
//Set the program to get transparency
this._setOpacity = isIE ? function(opacity){ = "alpha(opacity:" + opacity + ")"; } : function(opacity){ = opacity / 100; };
this._getOpacity = isIE ? function(){ return parseInt(["alpha"].opacity); } : function(opacity){ return 100 * parseFloat(); };
//Get border width program
this._xBorder = function(){ return (parseInt() + parseInt()); }
this._yBorder = function(){ return (parseInt() + parseInt()); }
(options);
= ;
= ();
= ;
//Set special default values first
= new FadeStruct({ end: 100 });
= new FadeStruct({ start: this._obj.offsetTop, end: this._obj.offsetTop });
= new FadeStruct({ start: this._obj.offsetLeft, end: this._obj.offsetLeft });
= new FadeStruct({ end: this._obj.offsetHeight - this._yBorder() });
= new FadeStruct({ end: this._obj.offsetWidth - this._xBorder() });
//Set the user default value again
(, );
(, );
(, );
(, );
(, );
//Change position parameters
= Number();
= Number();
//Set to default state
= !;
= 1;
();
//Reset Step
= ();
},
//Set default properties
SetOptions: function(options) {
= {//Default value
Opacity: {},//Transparent gradient parameters
Height: {},//Height gradient parameters
Width: {},//Width gradient parameters
Top: {},//Top gradient parameters
Left: {},//Left gradient parameters
Step: 10,//Rate of Change
Time: 10,//Change interval
Mode: "both", //Gradial order
Show: false, // Is it open by default
onFinish: function(){}//Execute when finished
};
(, options || {});
},
//trigger
Start: function() {
clearTimeout(this._timer);
//Inverse indicates the status to be set
= !;
//To avoid the transparency being null value, you need to set the transparency first
if(){ this._setOpacity( ? : ); }
//Set the target value according to the status
if(){
= ;
= ;
= ;
= ;
= ;
} else{
= ;
= ;
= ;
= ;
= ;
}
//Set the gradient program
switch (()) {
case "width" :
this._fun = function(){
() && ();
//Because it is divided into two steps, the step size below becomes twice as long as it is
= 2*;
(); (); ();
= /2;
}
break;
case "height" :
this._fun = function(){
() && ();
//Because it is divided into two steps, the step size below becomes twice as long as it is
= 2*;
(); (); ();
= /2;
}
break;
case "both" :
default :
this._fun = function(){ (); (); (); (); ();}
}
//Get the transform point position
//Because there is a conflict with top and left transformations after setting the transformation point, only one of them can be executed
if(){ this._y = this._obj.offsetTop + this._obj.offsetHeight * ; = false; }
if(){ this._x = this._obj.offsetLeft + this._obj.offsetWidth * ; = false; }
();
},
//implement
Run: function() {
clearTimeout(this._timer);
this._finish = true;
//Execute gradient
this._fun();
//Continue execution without completion
if (this._finish) { (); }
else { var oThis = this; this._timer = setTimeout(function(){ (); }, ); }
},
//Set height gradient
SetHeight: function() {
var iGet = (, this._obj.offsetHeight - this._yBorder());
if(isNaN(iGet)) return true;
this._obj. = iGet + "px";
//If there is a change point setting
if(){ this._obj. = this._y - this._obj.offsetHeight * + "px"; }
return false;
},
//Set width gradient
SetWidth: function() {
var iGet = (, this._obj.offsetWidth - this._xBorder());
if(isNaN(iGet)) return true;
this._obj. = iGet + "px";
if(){ this._obj. = this._x - this._obj.offsetWidth * + "px"; }
return false;
},
//Set top gradient
SetTop: function() {
var iGet = (, this._obj.offsetTop);
if(isNaN(iGet)) return true;
this._obj. = iGet + "px";
return false;
},
//Set left gradient
SetLeft: function() {
var iGet = (, this._obj.offsetLeft);
if(isNaN(iGet)) return true;
this._obj. = iGet + "px";
return false;
},
//Set transparent gradient
SetOpacity: function() {
var iGet = (, this._getOpacity());
if(isNaN(iGet)) return true;
this._setOpacity(iGet);
return false;
},
//Get the set value
Get: function(o, now){
if(){
var iStep = ( - now) / ;
if(iStep){
this._finish = false;
if((iStep) < 1){ iStep = iStep > 0 ? 1 : -1; }
return now + iStep;
}
}
}
};