No, you do have the new version of the script installed. I was referring to Spyr's post, which is based on the old version, and isn't applicable here even if a solution was mentioned.
If I understood your question correctly then, what you're basically trying to do is to be able to expand a content on demand based on the ID of the content. Add the below code to the end of switchicon.js:
Code:
//PUBLIC: Expands a content based on its ID entered
switchicon.prototype.userexpand=function(id){
var header=document.getElementById(id+"-title")
var innercontent=document.getElementById(id)
innercontent.style.display="block"
if (this.collapsePrev && typeof this.prevHeader!="undefined" && this.prevHeader.id!=header.id) // If "Collapse Previous" is enabled and there's a previous open content
this.contractcontent(this.prevHeader) //Contract that content first
if (this.collapsePrev)
this.prevHeader=header //Set current expanded content as the next "Previous Content"
header.innerHTML=this.openHTML
header=null
}
Then, in your HTML page, you can call userexpand() as you wish to expand a particular content on demand. For example:
Code:
var faq=new switchicon("icongroup1", "div") //Limit scanning of switch contents to just "div" elements
faq.setHeader('<img src="minus.gif" />', '<img src="plus.gif" />') //set icon HTML
faq.collapsePrevious(true) //Allow only 1 content open at any time
faq.setPersist(false) //No persistence enabled
//faq.defaultExpanded(0) //Set 1st content to be expanded by default
faq.init()
window.onload=function(){
faq.userexpand("faq3")
}
The code in red is new, and will expand the content "faq3" when the page fully loads.
Bookmarks