nicker
08-26-2012, 10:49 PM
Im having a problem with switch content script http://www.dynamicdrive.com/dynamicindex17/switchcontent.htm
I made it on my website so on the left I have menu with headers, each has different ID, like s1-title, s2-title, i have like 15 of them
then on the right i have box where content is displayed, with 15 div's, like <div id="s1" class="helpcont">, ID is different for each, class is the same.
problem is that I cant set default expanded div with content when i add line "instance.defaultExpanded(0)", it just expands all the content div's at the same time. afaik (0) here means index number of the content div. shall i set it somehow in this case?
the script part:
<script type="text/javascript">
// MAIN FUNCTION: new switchcontent("class name", "[optional_element_type_to_scan_for]") REQUIRED
// Call Instance.init() at the very end. REQUIRED
var bobexample=new switchcontent("helpcont", "div") //Limit scanning of switch contents to just "div" elements
bobexample.setColor('#ff6600', '#4d4d4d')
bobexample.setPersist(false)
bobexample.collapsePrevious(true) //Only one content open at any given time
instance.defaultExpanded(0)
bobexample.init()
</script>
I made it on my website so on the left I have menu with headers, each has different ID, like s1-title, s2-title, i have like 15 of them
then on the right i have box where content is displayed, with 15 div's, like <div id="s1" class="helpcont">, ID is different for each, class is the same.
problem is that I cant set default expanded div with content when i add line "instance.defaultExpanded(0)", it just expands all the content div's at the same time. afaik (0) here means index number of the content div. shall i set it somehow in this case?
the script part:
<script type="text/javascript">
// MAIN FUNCTION: new switchcontent("class name", "[optional_element_type_to_scan_for]") REQUIRED
// Call Instance.init() at the very end. REQUIRED
var bobexample=new switchcontent("helpcont", "div") //Limit scanning of switch contents to just "div" elements
bobexample.setColor('#ff6600', '#4d4d4d')
bobexample.setPersist(false)
bobexample.collapsePrevious(true) //Only one content open at any given time
instance.defaultExpanded(0)
bobexample.init()
</script>