PDA

View Full Version : Featured Content Slider



Colemilner
12-02-2006, 07:52 PM
1) Script Title: Featured Content Slider

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

3) Describe problem: I would like to make the menu be customizable as far as content. I mean, I would like the buttons to say "News" "Photos" etc. rather than "1" "2" "3" "Next" Is there any way to do this?
Thank you

jscheuer1
12-03-2006, 07:39 AM
Yes but, there are two levels of difficulty involved depending upon if you want more than one Featured Content Slider on a page with more than one set of customized links or not. For just one set of customized links used with one or more sliders on a page, edit contentslider.js here:


for (var i=0; i<slidernodes[sliderid].length; i++) //For each DIV within slider, generate a pagination link
pcontent+='<a href="#" onClick=\"ContentSlider.turnpage(\''+sliderid+'\', '+i+'); return false\">'+(i+1)+'</a> '
pcontent+='<a href="#" style="font-weight: bold;" onClick=\"ContentSlider.turnpage(\''+sliderid+'\', parseInt(this.getAttribute(\'rel\'))); return false\">Next</a>'

in the function called:

ContentSlider.buildpagination=function(sliderid)

What you can do is use an array of custom links (use as many thelinks[#]'s as you need):


var thelinks=[];
thelinks[0]='News';
thelinks[1]='Photos';
thelinks[2]='etc.';

Place the array at the top of the script before anything else. Then in the part we were looking at before, do this (change is in red, scroll the code section to see it):


for (var i=0; i<slidernodes[sliderid].length; i++) //For each DIV within slider, generate a pagination link
pcontent+='<a href="#" onClick=\"ContentSlider.turnpage(\''+sliderid+'\', '+i+'); return false\">'+thelinks[i]+'</a> '
pcontent+='<a href="#" style="font-weight: bold;" onClick=\"ContentSlider.turnpage(\''+sliderid+'\', parseInt(this.getAttribute(\'rel\'))); return false\">Next</a>'

The word 'Next' is hard coded (highlighted blue in the above). To change it, just change it.

If that is all you need, fine. If you need more than one set of custom links per page, let me know.

queerfm
12-28-2006, 07:04 PM
hi just wondering is there anyway to tell this script to make sure that they have a < br /> between them?

queerfm
12-28-2006, 07:07 PM
don't worry i found out how.

just add change the following. Please note this is after the update as been made. listed above

for (var i=0; i<slidernodes[sliderid].length; i++) //For each DIV within slider, generate a pagination link
pcontent+='<a href="#" onClick=\"ContentSlider.turnpage(\''+sliderid+'\', '+i+'); return false\">'+thelinks[i]+'</a> '


replace with

for (var i=0; i<slidernodes[sliderid].length; i++) //For each DIV within slider, generate a pagination link
pcontent+='<br/><a href="#" onClick=\"ContentSlider.turnpage(\''+sliderid+'\', '+i+'); return false\">'+thelinks[i]+'</a> '