Fading Text

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Freightliner

    Fading Text

    Hi,

    this script here displays a fading text message.
    I would like to display 3 different messages, let's say "Fading text
    1", "Fading text 2", "Fading text 3".

    Also, is there a way to make it work under FireFox too?

    Thank you very much for help




    <SCRIPT LANGUAGE="JavaS cript1.2">

    ie4 = ((navigator.app Version.indexOf ("MSIE")>0) &&
    (parseInt(navig ator.appVersion ) >= 4));
    var cnt = 0, cnt2 = 0, add1 = 3, add2 = 10, timerID;

    function show() {
    if (ie4) {
    cnt += add1;
    cnt2 += add2;
    delay = 30;
    if(cnt2 100) cnt2 = 100;
    if(cnt 100) {
    cnt = 100;
    add1 = -10;
    add2 = -3;
    delay = 350;
    }
    if(cnt < 0) cnt = 0;
    if(cnt2 < 0) {
    cnt2 = 0;
    add1 = 3;
    add2 = 10;
    delay = 200;
    }
    fader.style.fil ter = "Alpha(Opacity= "+cnt2+",Finish Opacity="+cnt
    +",style=2)" ;
    timerID = setTimeout("sho w()", delay);
    }
    }
    window.onload = show;
    </script>

    </head>

    <body bgcolor="#9B360 0">

    <center<div id="fader" style="width:48 0;
    Filter:Alpha(Op acity=0,FinishO pacity=0,style= 2)">
    <h4<font family="Arial, Helvetica" color="#FFFFCC" >
    FADING TEXT 1
    <br><br></font></h4</div</center>


    </body>
    </html>
  • Jeremy J Starcher

    #2
    Re: Fading Text

    On Mon, 03 Mar 2008 10:50:08 -0800, Freightliner wrote:
    If you had read the the link I gave you, you'd have been able to discount
    this one right off.

    Comment

    • Jeremy J Starcher

      #3
      Re: Fading Text

      On Tue, 04 Mar 2008 19:52:58 +0000, Jeremy J Starcher wrote:
      * * *
      How to improve the script and make it fail gracefully:
      >
      My first idea would be quick and dirty. Put all of the text into the
      DIVs or the SPANs so it is available, then use Javascript to 'extract
      them' and fade them back in. Perhaps conditionally inline a style sheet
      to set the DIV's to "hidden" when JS is available.
      >
      Change the array to a list of divs to extract the strings from and re-
      fade in.
      Figures I would remember something important after I posted.

      In addition, pre-check the fade methods. If the message can't be faded
      back in, don't get rid of it in the first place. That will handle
      browsers that either don't support opacity or are not handled by your
      code. (IIRC, Konqueror has its own way of setting opacity, but I don't
      have that here at the moment.)

      Comment

      Working...