PDA

View Full Version : Wrapping featured content glider.init in a function?



BrandonATL
03-13-2008, 11:16 PM
1) Script Title: Featured Content Glider

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/featuredcontentglider.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

ddadmin
03-14-2008, 07:38 AM
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:


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)

BrandonATL
03-15-2008, 01:41 AM
Excellent! Thank you! :)