Results 1 to 4 of 4

Thread: Random start page in Featured Content Glider?

  1. #1
    Join Date
    Apr 2008
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Smile Random start page in Featured Content Glider?

    1) Script Title: Featured Content Glider

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

    3) Describe problem: This script is exactly what I need. I have but one question: Let's say I have 20 sets of conent for the script. Is there a way to tell the script to start on a randomly selected page?

    OK, I lied I have an additional question related to the first... Is there a way to add a 'random' buttion in addition to the 'next' and 'previous buttons'?

    Thanks a lot. I just found this site recently. I was good at html 10 years agoi and now I am trying to catch up. I have learned a lot from this site.

  2. #2
    Join Date
    Aug 2004
    Posts
    9,903
    Thanks
    3
    Thanked 967 Times in 955 Posts
    Blog Entries
    15

    Default

    The first part is very simple. Within your initialization code, simply change the following line in red to the below:

    Code:
    featuredcontentglider.init({
    	gliderid: "canadaprovinces", //ID of main glider container
    	contentclass: "glidecontent", //Shared CSS class name of each glider content
    	togglerid: "p-select", //ID of toggler container
    	remotecontent: "", //Get gliding contents from external file on server? "filename" or "" to disable
    	selected: Math.floor(Math.random()*3), //Default selected content index (0=1st)
    "
    "
    In other words, instead of an integer like 0, change it to Math.floor(Math.random()*3), where 3 should be the total number of contents you have within the glider.

    Regarding the 2nd question, the script currently doesn't expose any public methods for easily jumping to a particular slide unfortunately.

  3. #3
    Join Date
    Jan 2007
    Posts
    82
    Thanks
    30
    Thanked 18 Times in 17 Posts

    Default

    It is possible to add a "random" effect to this script. To do so you would need to basically just refresh the content, and the random attribute would do its job nicely.

    I would accomplish this by placing the entire script inside of a div, and creating a button that onclick only refreshed the contents of that div. It would look kind of trashy if the whole page reloaded. You just make the button say "random" and no one knows the difference.

  4. The Following User Says Thank You to tonyking For This Useful Post:

    damara (04-22-2008)

  5. #4
    Join Date
    Apr 2008
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    thanks a lot to both people.

    As far as telling a button to refresh a <div> please give me the code...

    Like I said I was good at all this ten years ago, I am a noob at this dhtml stuff...

    If I get this thing to work it will be exactly what I need.

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
  •