www.webdeveloper.com
Results 1 to 2 of 2

Thread: How can I stop the loop in my slide show?

  1. #1
    Join Date
    Dec 2013
    Posts
    1

    How can I stop the loop in my slide show?

    Hello,
    For my school I had to make a website. For this, I coppied a code for a slideshow with javascript.
    But I want it to stop after one time..
    I can't find what I have to chance, so if someone could help me, I would be very happy!
    This is the code:

    <!DOCTYPE html>
    <html style="height: 100%; width: 100%; font-family:calibri">
    <head>
    <script language="JavaScript1.1">
    <!--

    var slideimages=new Array()
    var slidelinks=new Array()
    function slideshowimages(){
    for (i=0;i<slideshowimages.arguments.length;i++){
    slideimages[i]=new Image()
    slideimages[i].src=slideshowimages.arguments[i]
    }
    }

    function gotoshow(){
    if (!window.winslide||winslide.closed)
    winslide=window.open(slidelinks[whichlink])
    else
    winslide.location=slidelinks[whichlink]
    winslide.focus()
    }

    //-->
    </script>
    </head>

    <body>
    <img src="food1.jpg" name="slide" border=0 width=400 height=500></a>
    <script>
    <!--

    //configure the paths of the images
    slideshowimages("../Images/Start.jpg","../Images/Start.jpg","../Images/3.jpg","../Images/2.jpg","../Images/1.jpg","../Foto's test/foto 1.jpg")

    //configure the speed of the slideshow, in miliseconds
    var slideshowspeed=1200

    var whichlink=0
    var whichimage=0
    function slideit(){
    if (!document.images)
    return
    document.images.slide.src=slideimages[whichimage].src
    whichlink=whichimage
    if (whichimage<slideimages.length-1)
    whichimage++
    else
    whichimage=0
    setTimeout("slideit()",slideshowspeed)
    }
    slideit()

    //-->
    </script>
    </body>
    </html>

    I would like the slide show to stop on the last image.
    Thanks alot!!

  2. #2
    Join Date
    Jun 2004
    Location
    Portsmouth UK
    Posts
    2,687
    Code:
    <!DOCTYPE html>
    <html style="height: 100%; width: 100%; font-family:calibri">
    <head>
    <script>
    <!--
    
    var slideimages=new Array()
    var slidelinks=new Array()
    function slideshowimages(){
    for (i=0;i<slideshowimages.arguments.length;i++){
    slideimages[i]=new Image()
    slideimages[i].src=slideshowimages.arguments[i]
    }
    }
    
    function gotoshow(){
    if (!window.winslide||winslide.closed)
    winslide=window.open(slidelinks[whichlink])
    else
    winslide.location=slidelinks[whichlink]
    winslide.focus()
    }
    
    //-->
    </script>
    </head>
    
    <body>
    <img src="food1.jpg" name="slide" border=0 width=400 height=500></a>
    <script>
    <!--
    
    //configure the paths of the images
    slideshowimages("../Images/Start.jpg","../Images/Start.jpg","../Images/3.jpg","../Images/2.jpg","../Images/1.jpg","../Foto's test/foto 1.jpg")
    
    //configure the speed of the slideshow, in miliseconds
    var slideshowspeed=1200;
    
    var whichlink=0;
    var whichimage=0;
    
    function slideit(){
    document.images.slide.src=slideimages[whichimage].src;
    whichlink=whichimage;
    whichimage++;
    slideimages[whichimage]?setTimeout("slideit()",slideshowspeed):null;
    }
    
    slideit()
    
    //-->
    </script>
    </body>
    </html>
    Vic

    God loves you and will never love you less.

    http://www.vicsjavascripts.org/Home.htm
    If my post has been useful please donate to http://www.operationsmile.org.uk/

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