#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2003
    Location
    TrondH
    Posts
    45
    Rep Power
    12

    small problem with my slideshow (javascript), need help


    I have a slideshow script.
    I call for it this way on my page

    <td id="VU"> <img src="layout/logga_stor.jpg" name='SlideShow'></td>

    As you see it first loads a picture before starting the slideshow. I was wondering how I could remove this from happening (I want it to start the slideshow right away and not to load "logga_stor.jpg" .)

    Here's the script:

    <script>

    function fullScreen(theURL) {
    window.open(theURL, '', 'fullscreen=yes, scrollbars=no');
    }


    // Set slideShowSpeed (milliseconds)
    var slideShowSpeed = 20500

    // Duration of crossfade (seconds)
    var crossFadeDuration = 3

    // Specify the image files
    var Pic = new Array()

    <?php
    $query="SELECT id FROM bildspel";
    $result=mysql_query($query);
    $i=0;
    while($row=mysql_fetch_row($result)) {
    echo "Pic[".$i."]='index.php?id=".$row['0']."'\n";
    $i++;
    }
    ?>



    var t
    var j = 0
    var p = Pic.length

    var preLoad = new Array()
    for (i = 0; i < p; i++){
    preLoad[i] = new Image()
    preLoad[i].src = Pic[i]
    }

    function runSlideShow(){
    if (document.all){
    document.images.SlideShow.style.filter="blendTrans(duration=2)"
    document.images.SlideShow.style.filter="blendTrans(duration=crossFadeDuration)"
    document.images.SlideShow.filters.blendTrans.Apply()
    }
    document.images.SlideShow.src = preLoad[j].src
    if (document.all){
    document.images.SlideShow.filters.blendTrans.Play()
    }
    j = j + 1
    if (j > (p-1)) j=0
    t = setTimeout('runSlideShow()', slideShowSpeed)
    }
    </script>
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    May 2003
    Posts
    1,014
    Rep Power
    15
    Hmm, not sure what you mean, but if you just don't want to load the image, don't specify the source...
    It's valid HTML 4.01 and works nicely...
    Code:
    <body onload="runSlideShow()">
    <img name='SlideShow' src='' alt=''>
    Hope this helps,
    Jeroen
  4. #3
  5. No Profile Picture
    Senior Citizen
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jan 2001
    Location
    leftcoast
    Posts
    2,019
    Rep Power
    16
    Load a transparent 1x1 pixel gif, sized to the first image in the show, into the image tag. This will assure the page is rendered smoothly, with a seamless transition to the first pic.

    <img src="pix.gif" width="400" height="200" name="SlideShow" alt="">
    Last edited by adios; June 5th, 2003 at 11:37 PM.

IMN logo majestic logo threadwatch logo seochat tools logo