PDA

View Full Version : Featured Content Glider script reset without page reload



justin-nc
05-24-2011, 05:48 PM
1) Script Title:
Featured Content Glider

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

3) Describe problem:
I am using multiple instances of this Glider script on a page, though I'm using another script to allow the user to toggle the display of each instance of the Glider script.

Is it possible to set it up so that when a user toggles on/off the display for each of the Glider scripts, it resets the newly displayed Glider script to be back to its first page?

I see the parameter "persiststate", but this doesn't work because the page is not refreshing, the other script is just using CSS to hide/unhide the Glider scripts.

If someone can at least point me in the right direction, that would be greatly appreciated.

Thanks

ddadmin
05-25-2011, 07:51 AM
You can get an instance of FCG to go to a particular slide from outside the pagination links by making a small adjustment to your initialization code. Specifically, first cache the settings for each FCG inside a variable before applying it to the init() function, for example:


var config1={
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(config1)

config1 should be an arbitrary but unique variable name for each instance of FCG on your page. With that change you can now go to a specific page within a FCG dynamically by calling the function:


featuredcontentglider.glide(config1, 0)

where glider1 is the variable containing your FCG's settings, and 0=1st page, 1=2nd page to show etc. In your case, you'll call the above line inside your code that toggles the FCG most likely.

justin-nc
05-30-2011, 03:04 AM
Thanks, that did the trick! Much appreciated!