CSDN首页图片轮换的部分代码在FF下可以正常工作
MzEffect.MoveTo.Extends(MzEffect, "MzEffect.MoveTo ").initialize=function()
{
var me=this, obj=me.element, op=me.options;
op.originalTop = obj.style.top;
op.originalLeft = obj.style.left;
op.originalPosition = obj.style.position;
me.originalY = parseFloat(obj.style.top || '0 ');
me.originalX = parseFloat(obj.style.left || '0 ');
me.offsetX = me.x - me.originalX;
me.offsetY = me.y - me.originalY;
if(obj.style.position == " ") obj.style.position = "relative ";
this.render=function(schedule)
{
schedule = me.schedule || schedule;
obj.style.left = (me.offsetX * schedule + me.originalX) + "px ";
obj.style.top = (me.offsetY * schedule + me.originalY) + "px ";
};
this.setPosition=function(x, y)
{
obj.style.top = y + "px ";
obj.style.left = x + "px ";
};
this.restore=function()
{
obj.style.top = op.originalTop;
obj.style.left = op.originalLeft;
obj.style.position = op.originalPosition;
};
};
//op{interval, duration, trend, color, beginColor, endColor, finalColor}
function n2h(s){s=parseInt(s).toString(16);return ( "00 "+ s).substr(s.length);}
MzEffect.Highlight=function(element, op){MzEffect.apply(this, arguments);};
MzEffect.Highlight.Extends(MzEffect, "MzEffect.Highlight ").initialize=function()
{
var op=this.options, obj=this.element, endColor= "#FFFFFF ";
if(System.ie) var backColor = (obj.currentStyle||obj.style).backgroundColor;
else var backColor = obj.getCssValue( "background-color ");
op.originalBgColor = obj.style.backgroundColor;
op.originalColor = obj.style.color;
if(backColor) endColor = MzEffect.formatColor(backColor);
op.beginColor = op.beginColor || "#FFFF00 ";
op.endColor = op.endColor || endColor;
op.finalColor = op.finalColor || obj.style.backgroundColor;
this.colors_base=[
parseInt(op.beginColor.substring(1,3),16),
parseInt(op.beginColor.substring(3,5),16),
parseInt(op.beginColor.substr(5),16)];
this.colors_var=[
parseInt(op.endColor.substring(1,3),16)-this.colors_base[0],
parseInt(op.endColor.substring(3,5),16)-this.colors_base[1],
parseInt(op.endColor.substr(5),16)-this.colors_base[2]];
this.finish=function()
{
if(op.color) obj.style.color = op.color;
obj.style.backgroundColor = op.finalColor;
};
this.render=function(schedule)
{
schedule = this.schedule || schedule;
var colors=[
n2h(Math.round(this.colors_base[0]+(this.colors_var[0]*schedule))),
n2h(Math.round(this.colors_base[1]+(this.colors_var[1]*schedule))),
n2h(Math.round(this.colors_base[2]+(this.colors_var[2]*schedule)))];
obj.style.backgroundColor = "# "+ colors.join( " ");
};
this.restore=function()
{
obj.style.color = op.originalColor;
obj.style.backgroundColor = op.originalBgColor;
};
this.dispose=function()
{
MzEffect.prototype.dispose.call(this);
delete this.colors_base;
delete this.colors_var;
};
};
MzEffect.Curtain=function(element, op)
{
op = System.extend(
{
direction: " ",
scaleContent: false
}, op||{});
MzEffect.apply(this, [element, op]);
}
MzEffect.Curtain.Extends(MzEffect, "MzEffect.Mask ").initialize=function()
{
var me=this, op=me.options, obj=me.element;
op.direction = op.direction.toLowerCase();
op.originalWidth = obj.style.width;
op.originalHeight = obj.style.height;
op.originalOverflow = obj.style.overflow;
op.originalPosition = obj.style.position;
op.originalVisibility = obj.style.visibility;
op.originalMarginTop = (obj.currentStyle || obj.style).marginTop;
op.originalOffsetWidth = obj.offsetWidth;
op.originalOffsetHeight = obj.offsetHeight;
obj.style.overflow = "hidden ";
this.restore=function()
{
obj.style.width = op.originalWidth;
obj.style.height = op.originalHeight;
obj.style.overflow = op.original
obj.style.position = op.originalPosition;
obj.style.marginTop = op.originalMarginTop;
obj.style.visibility = op.originalVisibility;
};
this.finish=function(){this.restore();};
this.render=function(schedule){};
};
//op{interval, duration, trend, dirction}
MzEffect.Mask=function(element, op)
{
op=System.extend({direction: "box "}, op||{});
MzEffect.apply(this, [element, op]);
[解决办法]
这个是meizz写的,到js版问他吧。。。。他的变量名,一成不变啊。。。。