PDA

View Full Version : Featured Content Slider v2.0 - get slide onload



rian701
05-26-2008, 04:12 PM
1) Script Title: Featured Content Slider v2.0

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

3) Describe problem: Is there any way to load a specific slide when you loads the page? I have seen that you can use:

ContentSlider.turnpage('slider_id' 3)

But I can't get it to work.

I.E:
URL: www.test.com/index.aspx?sliderId=3

ddadmin
05-26-2008, 09:47 PM
There's no public methods right now for loading a specific slide other than the first one when the page loads. You can do this by first changing the line:


setting.currentpage=(this.enablepersist)? persistedpage : 1

inside the .js file to:


setting.currentpage=(this.enablepersist)? persistedpage : setting.initialpage? setting.initialpage : 1

Then, when initializing your featured contents, specify a "initialpage" parameter:



featuredcontentslider.init({
id: "slider1", //id of main slider DIV
contentsource: ["inline", ""], //Valid values: ["inline", ""] or ["ajax", "path_to_file"]
toc: "#increment", //Valid values: "#increment", "markup", ["label1", "label2", etc]
nextprev: ["Previous", "Next"], //labels for "prev" and "next" links. Set to "" to hide.
enablefade: [true, 0.2], //[true/false, fadedegree]
initialpage: 2, //page number to start off with
autorotate: [true, 3000], //[true/false, pausetime]
onChange: function(previndex, curindex){ //event handler fired whenever script changes slide
//previndex holds index of last slide viewed b4 current (1=1st slide, 2nd=2nd etc)
//curindex holds index of currently shown slide (1=1st slide, 2nd=2nd etc)
}
})

This is different from jumping to a page via a URL parameter though.

rian701
05-27-2008, 07:23 AM
Thanks for the reply. Can I add a new function in the js that gets the id in the url.

var sliderId = 3;

and then

setting.currentpage=(this.enablepersist)? persistedpage : setting.initialpage? setting.initialpage : sliderId