PDA

View Full Version : fading text - how to stop looping


nanny
05-23-2009, 01:15 AM
Hi I love this script but only want it to loop once.
How do you change this:

var fadeSteps = 20;
var fadeDelay = 20;
var nextSetDelay = 1000;
var loopPrepend = true;
var arMessage = new Array("Fade-In Message 1", "Fade-In Message 2", "Fade-In Message 3", "Fade-In Message 4", "Fade-In Message 5", "Fade-In Message 6", "Fade-In Message 7");
var elIdx = 0, msgIdx = 0, fadeStep = 0;
var fadeElem;
var msgLen = arMessage.length;
function fadeMsg(){
if(elIdx == 5 || (!loopPrepend && (msgIdx == msgLen))){
if(elIdx != 5)msgIdx = 0;
elIdx = 0;
setTimeout('fadeMsg()', nextSetDelay);
}else{
if(msgIdx == msgLen)msgIdx = 0;
if(elIdx == 0){
for(var i=0;i<5;i++){setOpacity(document.getElementById('fadeEle m'+i), 0);}
}
fadeStep = 20;
fadeElem = document.getElementById('fadeElem' + elIdx);
fadeElem.innerHTML = arMessage[msgIdx];
fadeStep = 0;
elIdx++;
msgIdx++;
fadeIn();
}
}
function fadeIn() {
if(fadeStep > fadeSteps){
fadeMsg();
return;
}
setOpacity(fadeElem, (fadeStep/fadeSteps));
fadeStep++;
window.setTimeout("fadeIn()", fadeDelay);
}
function setOpacity( el, opacity){
if(el.style.opacity != undefined){
el.style.opacity = opacity;
}else if( el.style.MozOpacity != undefined){
el.style.MozOpacity = opacity;
}else if ( el.style.filter != undefined){
el.style.filter="alpha(opacity=" + Math.round(opacity * 100) + ")";
}
}


I tried to change loopPrepend to false but didn't work.
Thanks

edbr
05-23-2009, 01:38 AM
var loopPrepend = true; try false

nanny
05-31-2009, 05:35 AM
Hi - yes I tried that and didn't do a thing.

edbr
06-01-2009, 01:03 AM
sorry just a guess, seemed like a good idea at the time

edbr
06-01-2009, 04:36 AM
and i just saw the last part of your post !
have a look at this
http://www.codingforums.com/showthread.php?t=160338

Ranana_Etex
06-14-2009, 07:00 AM
Hello all,I let the users to upload files and not only images.I want before the file upload to check the size of the file.I now how to do that with images but not with files.Does any one have an idea?Thanks

nanny
07-01-2009, 05:11 AM
and i just saw the last part of your post !
have a look at this
http://www.codingforums.com/showthread.php?t=160338


Thanks - amazing what you can find sometimes.
Cheers