PDA

View Full Version : Switch Content Script - inside Expandable iframe



tareqy
04-09-2007, 03:58 PM
1) Script Title: Switch Content Script

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

3) Describe problem:
I've using this script inside that a page, that is loaded inside expandadle iframe, is there a way to modify the script to make it call paren.resizeIframe when any text block is expanded.

Thanks,
Tareq

jscheuer1
04-09-2007, 04:30 PM
I'd go after these two functions (additions dark red):


//PRIVATE: Contracts a content based on its corresponding header entered

switchcontent.prototype.contractcontent=function(header){
var innercontent=document.getElementById(header.id.replace("-title", "")) //Reference content for this header
innercontent.style.display="none"
this.togglestatus(header, this.statusClosed)
this.togglecolor(header, this.colorClosed)
parent.resizeIframe();
}


//PRIVATE: Expands a content based on its corresponding header entered

switchcontent.prototype.expandcontent=function(header){
var innercontent=document.getElementById(header.id.replace("-title", ""))
innercontent.style.display="block"
this.togglestatus(header, this.statusOpen)
this.togglecolor(header, this.colorOpen)
parent.resizeIframe();
}

And possibly this one as well:


switchcontent.prototype.sweepToggle=function(setting){ //PUBLIC: Expand/ contract all contents method. (Values: "contract"|"expand")
if (typeof this.headers!="undefined" && this.headers.length>0){ //if there are switch contents defined on the page
for (var i=0; i<this.headers.length; i++){
if (setting=="expand")
this.expandcontent(this.headers[i]) //expand each content
else if (setting=="contract")
this.contractcontent(this.headers[i]) //contract each content
}
}
parent.resizeIframe();
}

There might be others but, hopefully that will do it.

tareqy
04-09-2007, 05:17 PM
John,

Thank you very much, you've just made my day ! :D
It's working perfect.

Have a nice day.

-Tareq