1) Script Title: content slider v.2.4
2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...tentslider.htm
3) Describe problem: Is there a way to have the previous and next links not show when there is only one page?
1) Script Title: content slider v.2.4
2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...tentslider.htm
3) Describe problem: Is there a way to have the previous and next links not show when there is only one page?
Try to add highlighted on contentslider.js to comment the building of next and previous link:
Code:buildpaginate:function(setting){ this.buildcontentdivs(setting) var sliderdiv=document.getElementById(setting.id) var pdiv=document.getElementById("paginate-"+setting.id) var phtml="" var toc=setting.toc var nextprev=setting.nextprev if (typeof toc=="string" && toc!="markup" || typeof toc=="object"){ for (var i=1; i<=setting.contentdivs.length; i++){ phtml+='<a href="#'+i+'" class="toc">'+(typeof toc=="string"? toc.replace(/#increment/, i) : toc[i-1])+'</a> ' }//phtml=(nextprev[0]!=''? '<a href="#prev" class="prev">'+nextprev[0]+'</a> ' : '') + phtml + (nextprev[1]!=''? '<a href="#next" class="next">'+nextprev[1]+'</a>' : '') pdiv.innerHTML=phtml }
Learn how to code at 02geek
The more you learn, the more you'll realize there's much more to learn
Ray.ph!
Commenting that line out does remove the previous and next links. The problem is that my content slider uses ajax to pull in a php page for the "contentsource". So, I'd want the previous and next links to display when there is more than one page. I just don't want them to display when there is only one page.
I see in the js where it sets the previous and next links but I'm not sure how to set display:none if there's only one page.
Now I understand what you mean, try to add highlighted instead:
See if it helps.Code:if(document.getElementById(setting.id).getElementsByTagName("div").length>1)phtml=(nextprev[0]!=''? '<a href="#prev" class="prev">'+nextprev[0]+'</a> ' : '') + phtml + (nextprev[1]!=''? '<a href="#next" class="next">'+nextprev[1]+'</a>' : '') pdiv.innerHTML=phtml
Learn how to code at 02geek
The more you learn, the more you'll realize there's much more to learn
Ray.ph!
Thanks I got it working. getElementsByTagName("div").length was giving me 11 even though there was only 1 content div. But, I used setting.contentdivs.length to get the number of pages and it worked:
Thanks for pointing me in the right direction.Code:if(setting.contentdivs.length>1) { phtml=(nextprev[0]!=''? '<a href="#prev" class="prev">'+nextprev[0]+'</a> ' : '') + phtml + (nextprev[1]!=''? '<a href="#next" class="next">'+nextprev[1]+'</a>' : '') pdiv.innerHTML=phtml }
Bookmarks