Results 1 to 4 of 4

Thread: Tab Content script > rotation stops after 2 cycles

  1. #1
    Join Date
    May 2009
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Tab Content script > rotation stops after 2 cycles

    1) Script Title: Tab Content Script (v 2.2)

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

    3) Describe problem:
    Hello,

    I installed the tab content script which works fine :
    http://www.dynamicdrive.com/dynamici...suppliment.htm

    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.

    Angie
    Last edited by Snookerman; 05-07-2009 at 01:24 PM. Reason: added “Resolved” prefix

  2. #2
    Join Date
    May 2009
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I post the init function that needs to be modified... I didn't succeed by myself :

    Code:
    	init:function(automodeperiod){
    		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)
    				this.tabs[i].onclick=function(){
    					tabinstance.expandtab(this)
    					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
    					this.revcontentids=this.revcontentids.concat(this.tabs[i].getAttribute("rev").split(/\s*,\s*/))
    				}
    				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.

  3. #3
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    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:

    Code:
    if (this.elapsedcycles >= this.hottabspositions.length*2)
    Attached Files Attached Files
    DD Admin

  4. #4
    Join Date
    May 2009
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thumbs up

    Thank you very much, the modified file works fine.

    Thanks again for your help and your great work !

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •