Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Jun 2004
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Smile Remove Crossfade from Slideshow?

    Hi,
    I am not a JavaScript expert by any means, but I can sometimes adapt a script for my own use. I am attempting to use a script from Codelifter.com, it's a JavaScript slideshow at:
    http://www.codelifter.com/main/javas...lideshow4.html

    I would post just the relevant sections, but I am not skilled enough to single those out effectively. The problem I am having is that the crossfade timing is *supposed* to be adjustable, and I have tried changing the duration:

    // Set the duration of crossfade (in seconds)
    var CrossFadeDuration = 1;

    but no number I put in appears to change the duration, I was hoping a duration of 0 would eliminate the effect, but no luck there.

    Can anyone point me in the right direction?
    Thanks!

  • #2
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    10,966
    Thanks
    0
    Thanked 236 Times in 233 Posts
    Changing from 2 to 1 is not quite noticeable but it makes the fade a little faster. If you want to eliminate the effect if set to 0, you have to modify the control() function.
    Code:
    function control(how){
      if (showHot){
        if (how=="H") jss = 1;
        if (how=="F") jss = jss + 1;
        if (how=="B") jss = jss - 1;
        if (jss > (pss)) jss=1;
        if (jss < 1) jss = pss;
        if (document.all && CrossFadeDuration>0){
           document.images.PictureBox.style.filter="blendTrans(duration=2)";
           document.images.PictureBox.style.filter="blendTrans(duration=CrossFadeDuration)";
           document.images.PictureBox.filters.blendTrans.Apply();
        }
        document.images.PictureBox.src = preLoad[jss].src;
        if (document.getElementById) document.getElementById("CaptionBox").innerHTML= Caption[jss];
        if (document.all && CrossFadeDuration>0) document.images.PictureBox.filters.blendTrans.Play();
      }
      return false;
    }
    ...
    <a class="Controls" href="#" onClick="return control('B');">< <</a>
    ...
    I also added the return false bit so that the link action is cancelled and # will not show in the address bar.

  • #3
    New to the CF scene
    Join Date
    Jun 2004
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thumbs up

    Thank you so much, that works perfectly!
    Betty

  • #4
    Senior Coder
    Join Date
    Aug 2002
    Location
    UK
    Posts
    2,789
    Thanks
    2
    Thanked 14 Times in 14 Posts
    In order to change the blend duration please try the following

    Change to following line

    document.images.PictureBox.style.filter="blendTrans(duration=2)";

    to

    document.images.PictureBox.style.filter="blendTrans()";

    comment out the following line

    document.images.PictureBox.style.filter="blendTrans(duration=CrossFadeDuration)";

    //document.images.PictureBox.style.filter="blendTrans(duration=CrossFadeDuration)";

    change the following line

    if (document.all) document.images.PictureBox.filters.blendTrans.Play();

    to

    if (document.all) document.images.PictureBox.filters.blendTrans.Play(CrossFadeDuration);

    then change the variable CrossFadeDuration to whatever you want

    var CrossFadeDuration = 5;


  •  

    Posting Permissions

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