我提出的问题是,我如何掌握多种职能。 下面是我的职能——一个简单的缺陷功能。 问题 我不得不说,当它第二次放弃了第一次呼吁。 因此,如果用户在一顿点点上点击,就会展示出一个 message的信息。
如果用户点击另一个纽州,则以前的散射电文在目前的不透明度上只是停留。
<>?
What is the stopping mechanism? Where did the previous function go?
www.un.org/spanish/ecosoc 职能
function newEffects(element, direction, max_time )
{
newEffects.arrayHold = [];
newEffects.arrayHold[element.id] = 0;
function next()
{
newEffects.arrayHold[element.id] += 10;
if ( direction === up )
{
element.style.opacity = newEffects.arrayHold[element.id] / max_time;
}
else if ( direction === down )
{
element.style.opacity = ( max_time - newEffects.arrayHold[element.id] ) / max_time;
}
if ( newEffects.arrayHold[element.id] <= max_time )
{
setTimeout( next, 10 );
}
}
next();
return true;
};
The Call
newEffects(this.element, down , 4000 );
Old Object
/**
* Effects - causes all elements that are fading to sync. to same opacity level as they share the same elapsed time.
*/
var Effects = function( element )
{
this.element = element;
};
Effects.prototype.fade = function( direction, max_time )
{
Effects.elapsed = 0;
var persist_element = this.element;
function next()
{
Effects.elapsed += 10;
if ( direction === up )
{
persist_element.style.opacity = Effects.elapsed / max_time;
}
else if ( direction === down )
{
persist_element.style.opacity = ( max_time - Effects.elapsed ) / max_time;
}
if ( Effects.elapsed <= max_time )
{
setTimeout( next, 10 );
}
}
next();
return true;
};