logo-dw

Go Back   Dreamweaver Club Forums > Hand Coders Forum > Javascript and JS frameworks
Register FAQ Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Display Modes
Old 05-23-2009, 01:15 AM   #1
nanny
 
Join Date: Apr 2006
Posts: 290
Default fading text - how to stop looping

Hi I love this script but only want it to loop once.
How do you change this:
Code:
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('fadeElem'+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
nanny is offline   Reply With Quote
Old 05-23-2009, 01:38 AM   #2
edbr
edbr's Avatar
 
Join Date: Aug 2005
Location: Bali
Posts: 11,164
Default

var loopPrepend = true; try false
__________________
If you're happy and you know it shake your meds!
different style links examples

Flight / Hotel search
Free script download
Bali Villas
edbr is offline   Reply With Quote
Old 05-31-2009, 05:35 AM   #3
nanny
 
Join Date: Apr 2006
Posts: 290
Default

Hi - yes I tried that and didn't do a thing.
nanny is offline   Reply With Quote
Old 06-01-2009, 01:03 AM   #4
edbr
edbr's Avatar
 
Join Date: Aug 2005
Location: Bali
Posts: 11,164
Default

sorry just a guess, seemed like a good idea at the time
__________________
If you're happy and you know it shake your meds!
different style links examples

Flight / Hotel search
Free script download
Bali Villas
edbr is offline   Reply With Quote
Old 06-01-2009, 04:36 AM   #5
edbr
edbr's Avatar
 
Join Date: Aug 2005
Location: Bali
Posts: 11,164
Default

and i just saw the last part of your post !
have a look at this
http://www.codingforums.com/showthread.php?t=160338
__________________
If you're happy and you know it shake your meds!
different style links examples

Flight / Hotel search
Free script download
Bali Villas
edbr is offline   Reply With Quote
Old 06-14-2009, 07:00 AM   #6
Ranana_Etex
Ranana_Etex's Avatar
 
Join Date: Jun 2009
Location: Israel
Posts: 8
Default fading text how to stop looping

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
Ranana_Etex is offline   Reply With Quote
Old 07-01-2009, 05:11 AM   #7
nanny
 
Join Date: Apr 2006
Posts: 290
Default

Quote:
Originally Posted by edbr View Post
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
nanny is offline   Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 07:28 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Copyright 2006 DreamweaverClub.com