Results 1 to 3 of 3

Thread: Wrapping featured content glider.init in a function?

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

    Default Wrapping featured content glider.init in a function?

    1) Script Title: Featured Content Glider

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

    3) Describe problem: I am wanting to use the feature where a remote file is retrieved to display the contents for the glider, but I'd like to make it dynamic depending on the situation. For example:

    function setUpGlider(page){

    featuredcontentglider.init({
    gliderid: "gliderish", //ID of main glider container
    contentclass: "glidecontent", //Shared CSS class name of each glider content
    togglerid: "p-select", //ID of toggler container
    remotecontent: page, //Get gliding contents from external file on server? "filename" or "" to disable
    selected: 0, //Default selected content index (0=1st)
    persiststate: false, //Remember last content shown within browser session (true/false)?
    speed: 500, //Glide animation duration (in milliseconds)
    direction: "rightleft", //set direction of glide: "updown", "downup", "leftright", or "rightleft"
    autorotate: false, //Auto rotate contents (true/false)?
    autorotateconfig: [3000, 2] //if auto rotate enabled, set [milliseconds_btw_rotations, cycles_before_stopping]
    })

    }


    Clearly this isn't working or I wouldn't be posting - but is there something similar to this that would work?

    Thanks for any help/guidance!

    -Brandon

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

    Default

    Sure, this can be done by giving a name to the object containing the parameters, so you can access it explicitly, and change its "remotecontent" parameter based on some variable. For example:

    Code:
    var myparameters={
     gliderid: "gliderish", //ID of main glider container
    contentclass: "glidecontent", //Shared CSS class name of each glider content
    togglerid: "p-select", //ID of toggler container
    selected: 0, //Default selected content index (0=1st)
    persiststate: false, //Remember last content shown within browser session (true/false)?
    speed: 500, //Glide animation duration (in milliseconds)
    direction: "rightleft", //set direction of glide: "updown", "downup", "leftright", or "rightleft"
    autorotate: false, //Auto rotate contents (true/false)?
    autorotateconfig: [3000, 2] //if auto rotate enabled, set [milliseconds_btw_rotations, cycles_before_stopping]
    }
    
    myparameters.remotecontent=page
    
    featuredcontentglider.init(myparameters)

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

    Default

    Excellent! Thank you!

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
  •