Results 1 to 4 of 4

Thread: General question about slideshows.

  1. #1
    Join Date
    Jan 2005
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default General question about slideshows.

    http://www.dynamicdrive.com/dynamici...nslideshow.htm
    http://www.dynamicdrive.com/dynamici...ucentslide.htm
    http://www.dynamicdrive.com/dynamicindex14/pixelate.htm
    http://www.dynamicdrive.com/dynamici...ropitslide.htm
    http://www.dynamicdrive.com/dynamicindex14/carousel.htm
    http://www.dynamicdrive.com/dynamicindex14/bookflip.htm

    I think that all mentioned above slideshows are brilliant. For my web page I need slideshow that will appear from nowhere and will disappear in nowhere. That is why I would like to stop slideshow on the very last slide. How can I modify any of mentioned scripts to stop endless rotation? Thank you in advance for your help.

  2. #2
    Join Date
    Dec 2004
    Posts
    177
    Thanks
    0
    Thanked 18 Times in 17 Posts

    Default

    I've only looked at one so far, but your third link (pixelate) change the following code:

    Code:
    function slideit(){
    if (!document.images) return
    if (ie55) document.images.slide.filters[0].apply()
    document.images.slide.src=imageholder[whichimage].src
    if (ie55) document.images.slide.filters[0].play()
    whichlink=whichimage
    whichimage=(whichimage<slideimages.length-1)? whichimage+1 : 0
    setTimeout("slideit()",slidespeed+pixeldelay)
    }
    to:

    Code:
    function slideit(){
    if (!document.images) return
    if (ie55) document.images.slide.filters[0].apply()
    document.images.slide.src=imageholder[whichimage].src
    if (ie55) document.images.slide.filters[0].play()
    whichlink=whichimage
    if (whichimage<slideimages.length-1){
     whichimage+=1 
     setTimeout("slideit()",slidespeed+pixeldelay)
    }
    }

  3. #3
    Join Date
    Dec 2004
    Posts
    177
    Thanks
    0
    Thanked 18 Times in 17 Posts

    Default

    Okay, fourth one down, dropitslide, works the same way

    Change:
    Code:
    function movepic(){
     if (curpos<0){
      curpos=Math.min(curpos+degree,0)
      tempobj.style.top=curpos+"px"
     }
     else{
      clearInterval(dropslide)
      nextcanvas=(curcanvas=="canvas0")? "canvas0" : "canvas1"
      tempobj=ie4? eval("document.all."+nextcanvas) : document.getElementById(nextcanvas)
      tempobj.innerHTML='<img src="'+dropimages[nextimageindex]+'">'
      nextimageindex=(nextimageindex<dropimages.length-1)? nextimageindex+1 : 0
      setTimeout("rotateimage()",pause)
     }
    }
    to:

    Code:
    function movepic(){
     if (curpos<0){
      curpos=Math.min(curpos+degree,0)
      tempobj.style.top=curpos+"px"
     }
     else{
      clearInterval(dropslide)
      nextcanvas=(curcanvas=="canvas0")? "canvas0" : "canvas1"
      tempobj=ie4? eval("document.all."+nextcanvas) : document.getElementById(nextcanvas)
      tempobj.innerHTML='<img src="'+dropimages[nextimageindex]+'">'
      if (nextimageindex<dropimages.length-1){
       nextimageindex+=1
       setTimeout("rotateimage()",pause)
      }
     }
    }

  4. #4
    Join Date
    Dec 2004
    Posts
    177
    Thanks
    0
    Thanked 18 Times in 17 Posts

    Default

    You know what, instead of posting the changes for them, all but the last 2 can be modified the same way. When looking at the original code, you should immediately look for the function 'setTimeout'. Try doing a Find in notepad. This line, and the line above it should look similar to:

    Code:
    whichimage=(whichimage<slideimages.length-1)? whichimage+1 : 0
    setTimeout("slideit()",slidespeed+pixeldelay)
    with only the variable names differing.

    This basically reads as "If whichimage is less than slideimages.length-1, then whichimage = whichimage + 1. If not, whichimage = 0. Now call function slideit() in this number of milliseconds."

    Sooooo, if the image it is on is LESS than the number of images, increment it. If it isn't, set it back to zero (so now we're back at the first image). Then, no matter the outcome, call slideit and change the picture. To modify it, you would change the above code to:

    Code:
    if (whichimage<slideimages.length-1){
     whichimage+=1
     setTimeout("slideit()",slidespeed+pixeldelay)
    }
    This now reads "If whichimage is less than slideimages.length-1, then whichimage = whichimage+1, and call slideit() in this number of milliseconds."

    Sooooo, if the image it is on is LESS than the number of images, increment and call the function again (change the image again). If it isn't, oh well, we're done. The slideit function is no longer called, images are no longer changing.

    Make any sense?
    Last edited by Minos; 01-09-2005 at 09:07 AM. Reason: Getting redundant.

Bookmarks

Posting Permissions

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