www.webdeveloper.com
Results 1 to 3 of 3

Thread: [RESOLVED] Question about "Fading Marquee";

  1. #1
    Join Date
    Apr 2011
    Posts
    3

    resolved [RESOLVED] Question about "Fading Marquee";

    Hey,

    At the following link http://javascript.internet.com/text-...g-marquee.html u can find a script that allows you to fade away text.
    While watching the example I asked myself the question if it was possible to change the text when it was faded instead of changing it when it was vissible again..?

    Can anyone help me about how to change the code?

    Thx in advance,
    Kind regards, MrWithQuestions.

  2. #2
    Join Date
    Apr 2011
    Posts
    3
    For the more lazy persons here
    I hope u masterminds can help me.
    Thx!

    Code:
    function setupFadeLinks() {
      arrFadeLinks[0] = "http://javascriptsource.com/snippets/popup-blocker-detection.html";
      arrFadeTitles[0] = "1. Popup Blocker Detection";
      arrFadeLinks[1] = "http://javascriptsource.com/forms/code-box-editor.html";
      arrFadeTitles[1] = "2. Code Box Editor";
      arrFadeLinks[2] = "http://javascriptsource.com/miscellaneous/mailto.html";
      arrFadeTitles[2] = "3. mailTo";
      arrFadeLinks[3] = "http://javascriptsource.com/cookies/delicious-cookies.html";
      arrFadeTitles[3] = "4. Delicious Cookies";
      arrFadeLinks[4] = "http://javascriptsource.com/snippets/insertafter.html";
      arrFadeTitles[4] = "5. insertAfter()";
    }
    
    // You can also play with these variables to control fade speed, fade color, and how fast the colors jump.
    
    var m_FadeOut = 255;
    var m_FadeIn=0;
    var m_Fade = 0;
    var m_FadeStep = 3;
    var m_FadeWait = 1600;
    var m_bFadeOut = true;
    
    var m_iFadeInterval;
    
    window.onload = Fadewl;
    
    var arrFadeLinks;
    var arrFadeTitles;
    var arrFadeCursor = 0;
    var arrFadeMax;
    
    function Fadewl() {
      m_iFadeInterval = setInterval(fade_ontimer, 10);
      arrFadeLinks = new Array();
      arrFadeTitles = new Array();
      setupFadeLinks();
      arrFadeMax = arrFadeLinks.length-1;
      setFadeLink();
    }
    
    function setFadeLink() {
      var ilink = document.getElementById("fade_link");
      ilink.innerHTML = arrFadeTitles[arrFadeCursor];
      ilink.href = arrFadeLinks[arrFadeCursor];
    }
    
    function fade_ontimer() {
      if (m_bFadeOut) {
        m_Fade+=m_FadeStep;
        if (m_Fade>m_FadeOut) {
          arrFadeCursor++;
          if (arrFadeCursor>arrFadeMax)
            arrFadeCursor=0;
          setFadeLink();
          m_bFadeOut = false;
        }
      } else {
        m_Fade-=m_FadeStep;
        if (m_Fade<m_FadeIn) {
          clearInterval(m_iFadeInterval);
          setTimeout(Faderesume, m_FadeWait);
          m_bFadeOut=true;
        }
      }
      var ilink = document.getElementById("fade_link");
      if ((m_Fade<m_FadeOut)&&(m_Fade>m_FadeIn))
        ilink.style.color = "#" + ToHex(m_Fade);
    }
    
    function Faderesume() {
      m_iFadeInterval = setInterval(fade_ontimer, 10);
    }
    
    function ToHex(strValue) {
      try {
        var result= (parseInt(strValue).toString(16));
    
        while (result.length !=2)
                result= ("0" +result);
        result = result + result + result;
        return result.toUpperCase();
      }
      catch(e)
      {
      }
    }

  3. #3
    Join Date
    Apr 2011
    Posts
    3

    resolved

    Quote Originally Posted by MrWithQuestions View Post
    For the more lazy persons here
    I hope u masterminds can help me.
    Thx!

    Code:
    function setupFadeLinks() {
      arrFadeLinks[0] = "http://javascriptsource.com/snippets/popup-blocker-detection.html";
      arrFadeTitles[0] = "1. Popup Blocker Detection";
      arrFadeLinks[1] = "http://javascriptsource.com/forms/code-box-editor.html";
      arrFadeTitles[1] = "2. Code Box Editor";
      arrFadeLinks[2] = "http://javascriptsource.com/miscellaneous/mailto.html";
      arrFadeTitles[2] = "3. mailTo";
      arrFadeLinks[3] = "http://javascriptsource.com/cookies/delicious-cookies.html";
      arrFadeTitles[3] = "4. Delicious Cookies";
      arrFadeLinks[4] = "http://javascriptsource.com/snippets/insertafter.html";
      arrFadeTitles[4] = "5. insertAfter()";
    }
    
    // You can also play with these variables to control fade speed, fade color, and how fast the colors jump.
    
    var m_FadeOut = 255;
    var m_FadeIn=0;
    var m_Fade = 0;
    var m_FadeStep = 3;
    var m_FadeWait = 1600;
    var m_bFadeOut = true;
    
    var m_iFadeInterval;
    
    window.onload = Fadewl;
    
    var arrFadeLinks;
    var arrFadeTitles;
    var arrFadeCursor = 0;
    var arrFadeMax;
    
    function Fadewl() {
      m_iFadeInterval = setInterval(fade_ontimer, 10);
      arrFadeLinks = new Array();
      arrFadeTitles = new Array();
      setupFadeLinks();
      arrFadeMax = arrFadeLinks.length-1;
      setFadeLink();
    }
    
    function setFadeLink() {
      var ilink = document.getElementById("fade_link");
      ilink.innerHTML = arrFadeTitles[arrFadeCursor];
      ilink.href = arrFadeLinks[arrFadeCursor];
    }
    
    function fade_ontimer() {
      if (m_bFadeOut) {
        m_Fade+=m_FadeStep;
        if (m_Fade>m_FadeOut) {
          arrFadeCursor++;
          if (arrFadeCursor>arrFadeMax)
            arrFadeCursor=0;
          setFadeLink();
          m_bFadeOut = false;
        }
      } else {
        m_Fade-=m_FadeStep;
        if (m_Fade<m_FadeIn) {
          clearInterval(m_iFadeInterval);
          setTimeout(Faderesume, m_FadeWait);
    here
          m_bFadeOut=true;
        }
      }
      var ilink = document.getElementById("fade_link");
      if ((m_Fade<m_FadeOut)&&(m_Fade>m_FadeIn))
        ilink.style.color = "#" + ToHex(m_Fade);
    }
    
    function Faderesume() {
      m_iFadeInterval = setInterval(fade_ontimer, 10);
    }
    
    function ToHex(strValue) {
      try {
        var result= (parseInt(strValue).toString(16));
    
        while (result.length !=2)
                result= ("0" +result);
        result = result + result + result;
        return result.toUpperCase();
      }
      catch(e)
      {
      }
    }
    Nevermind, i have solved this. It was just a small work to copy the red code to where 'here' stands..

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles