View Full Version : Resolved Tab Content script > rotation stops after 2 cycles

05-06-2009, 01:01 PM
1) Script Title: Tab Content Script (v 2.2)

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

3) Describe problem:

I installed the tab content script which works fine :

The problem is that I activated the rotation on the tabs and I want the rotation to stop after 2 or 3 cycles.

I've been trying to modify the init function on the .js file but failed.
Is there a way to do this?

Thank you for your help.


05-06-2009, 06:14 PM
I post the init function that needs to be modified... I didn't succeed by myself :

var persistedtab=ddtabcontent.getCookie(this.tabinterfaceid) //get position of persisted tab (applicable if persistence is enabled)
var selectedtab=-1 //Currently selected tab index (-1 meaning none)
var selectedtabfromurl=this.urlparamselect(this.tabinterfaceid) //returns null or index from: tabcontent.htm?tabinterfaceid=index
this.automodeperiod=automodeperiod || 0
for (var i=0; i<this.tabs.length; i++){
this.tabs[i].tabposition=i //remember position of tab relative to its peers
if (this.tabs[i].getAttribute("rel")){
var tabinstance=this
this.hottabspositions[this.hottabspositions.length]=i //store position of "hot" tab ("rel" attr defined) relative to its peers
this.subcontentids[this.subcontentids.length]=this.tabs[i].getAttribute("rel") //store id of sub content ("rel" attr value)
tabinstance.cancelautorun() //stop auto cycling of tabs (if running)
return false
if (this.tabs[i].getAttribute("rev")){ //if "rev" attr defined, store each value within "rev" as an array element
if (selectedtabfromurl==i || this.enabletabpersistence && selectedtab==-1 && parseInt(persistedtab)==i || !this.enabletabpersistence && selectedtab==-1 && this.getselectedClassTarget(this.tabs[i]).className=="selected"){
selectedtab=i //Selected tab index, if found
} //END for loop
if (selectedtab!=-1) //if a valid default selected tab index is found
this.expandtab(this.tabs[selectedtab]) //expand selected tab (either from URL parameter, persistent feature, or class="selected" class)
else //if no valid default selected index found
this.expandtab(this.tabs[this.hottabspositions[0]]) //Just select first tab that contains a "rel" attr
if (parseInt(this.automodeperiod)>500 && this.hottabspositions.length>1){
this.autoruntimer=setInterval(function(){tabinstance.autorun()}, this.automodeperiod)
} //END int() function

Thanks in advance for any help, idea that can be provided.

05-07-2009, 05:37 AM
Try the following modified .js file. If you wish to change the # of cycles from 2 to something else, change the part in red below:

if (this.elapsedcycles >= this.hottabspositions.length*2)

05-07-2009, 10:14 AM
Thank you very much, the modified file works fine.

Thanks again for your help and your great work !