I see you've already modified the switchcontent.js file to include some image swapping. And, as it turns out I already had a version of this script that includes a keepOneOpen() function. But it was from before the AJAX update. However, you're not using that. So here's what to do. Download and use this version of the script to which I've already added your swap() function modifications (right click and 'Save As'):
switchcontentonemust.js
Then in the on page init for the script, change:
Code:
<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 promiseexample=new switchcontent("switchgroup1", "div") //Limit scanning of switch contents to just "div" elements
promiseexample.setColor('darkred', 'black')
promiseexample.setPersist(true)
promiseexample.collapsePrevious(true) //Only one content open at any given time
promiseexample.init()
</script>
to:
Code:
<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 promiseexample=new switchcontent("switchgroup1", "div") //Limit scanning of switch contents to just "div" elements
promiseexample.setColor('darkred', 'black')
promiseexample.keepOneOpen('remain')
promiseexample.collapsePrevious(true) //Only one content open at any given time
promiseexample.defaultExpanded(0)
promiseexample.setPersist(true)
promiseexample.init()
</script>
The browser cache may need to be cleared and/or the page refreshed to see changes.
Bookmarks