The fact that the switch contents are visible until after the page loads is intentional, for accessibility reasons. It means if a visitor has JavaScript disabled, the content is still visible (and not contracted). If you wish your switch contents to be contracted from the very start, you can do so using CSS and targetting the switch contents' shared CSS class. Assume you have the below when initializing the script:
Code:
var bobexample=new switchcontent("switchgroup1", "div")
"
"
The shared CSS class in this case is "switchgroup1", which you can hide using CSS:
Code:
<style type="text/css">
.switchgroup1{
display: none;
}
</style>
The only caveat to this that I'm aware of is that it renders the defaultExpanded() function useless, meaning even if you specify that a DIV should be expanded by default, it will still appear contracted due to the global CSS hiding it.
Bookmarks