PDA

View Full Version : Resolved Use a URL or onClick to Display Content



jbur
06-04-2009, 01:25 AM
1) Script Title: Featured Content Glider

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/featuredcontentglider.htm

3) Describe problem: Is there a way to use a URL or “onClick” to manually display a particular slide “content” without using pagination links to toggle? I would like to use a form button to trigger the appropriate content. More to the point, I would like to use a chained select menu (http://www.dynamicdrive.com/dynamicindex1/chainedmenu/index.htm) with the Featured Content Glider.

ddadmin
06-04-2009, 06:58 AM
The function to call to go to a specific slide using arbitrary links (or otherwise) is the function:


featuredcontentglider.glide(glidersettings, pagenumber)

Before you can use the above function though, you'll need to modify your initialization code so the settings entered into it is stored inside a variable. For example:


var glidersettings={
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: 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: "downup", //set direction of glide: "updown", "downup", "leftright", or "rightleft"
autorotate: true, //Auto rotate contents (true/false)?
autorotateconfig: [3000, 2] //if auto rotate enabled, set [milliseconds_btw_rotations, cycles_before_stopping]
}


featuredcontentglider.init(glidersettings)

All I'm doing here is storing the settings in a variable before passing it into init(). With the settings cached, you can create an arbitrary link that jumps to page 3 when clicked on, for example:


<a href="javascript:featuredcontentglider.glide(glidersettings, 2)">Go to page 3</a>

jbur
06-04-2009, 03:05 PM
That makes sense and it works great!

Thank you, thank you, thank you. :)