Results 1 to 3 of 3

Thread: Featured Content Slider - Rotate 3 times and stop

  1. #1
    Join Date
    Mar 2007
    Location
    Laguna Beach, CA
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Cool Featured Content Slider - Rotate 3 times and stop

    1) Script Title: Featured Content Slider

    2) Script URL (on DD): http://dynamicdrive.com/dynamicindex...tentslider.htm

    3) Describe problem: The script works very well (thanks!), and was easy to integrate into my page. However, I don't like that it keeps going and going forever. I'd like it to automatically rotate, but I want it to go 3 times and then stop.

    I could modify the script myself, but since you're more familiar with the script I though you folks might have a better, more efficient solution than what I would do. Would you send me any ideas you have with this?

    In the future, it would be great if this were integrated into the script like this:

    OLD:
    ContentSlider("slider1", 3000, linktextarray, "Foward")

    NEW version examples slider rotates 3 times & stops:
    ContentSlider("slider1", 3000, linktextarray, "Foward", 3)
    or
    ContentSlider("slider1", 3000|3, linktextarray, "Foward")
    or
    ContentSlider("slider1", 3000, , , 3)

    Thanks!

    Web Maestro Clay

  2. #2
    Join Date
    Aug 2004
    Posts
    10,140
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    Sure, there are a few ways to do this, but my hacked up version would be to make the following changes to the .js file (or just download the modified .js file below). The changes to the original code are in red:

    Code:
    if (typeof autorun=="number" && autorun>0)
    window[sliderid+"timer"]=setTimeout(function(){ContentSlider.autoturnpage(sliderid, autorun, cycles || 0)}, autorun)
    AND:

    Code:
    ContentSlider.autoturnpage=function(sliderid, autorunperiod, cycles){
    "
    "
    if (cycles>0){
    var slider=document.getElementById(sliderid)
    if (nextpagenumber==0)
    slider.cyclecount=(typeof slider.cyclecount!="undefined")? slider.cyclecount+1 : 1
    if (slider.cyclecount && slider.cyclecount==cycles)
    return
    }
    window[sliderid+"timer"]=setTimeout(function(){ContentSlider.autoturnpage(sliderid, autorunperiod, cycles || 0)}, autorunperiod)
    Then, to invoke a content slider that ends after 2 cycles, specify that using the last optional parameter:

    Code:
    ContentSlider("slider1", 1000, "", "", 2)
    Last edited by ddadmin; 03-31-2007 at 11:08 AM.

  3. #3
    Join Date
    Mar 2007
    Location
    Laguna Beach, CA
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Thanks I'll give it a shot.

    Thanks I'll give it a shot!

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
  •