View Full Version : Switch Content Script defaultexpanded not working with preservance

03-31-2009, 04:46 AM
1) Script Title: Switch Content Script

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

3) Describe problem:

I need one of my content to be expanded by default but allow preservance. I noticed this update on the DD page,
Jan 25th, 07: to fix a bug with the defaultExpanded() feature not being honoured when persistence is enabled. Only applicable the first time the page is loaded within a browser session. Only .js file changed!

To me the bug is not fixed because I have the following set and it is not working:

<script type="text/javascript">
var instance=new switchcontent("switch-instance", "div")
instance.setStatus('<img src="/img/open.png" /> ', '<img src="/img/closed.png" /> ')
instance.setPersist(true, 7)

I cleared all cookies and cache and reload the page and the instance is not expanded. Can someone help?

03-31-2009, 07:09 AM
A quick test and it seems to work for me. Are you sure you're using the updated .js file? Please post a link to the page on your site that contains the problematic script so we can check it out.

04-02-2009, 03:11 AM
Hey man thanks for the quick response. I think I got it to work, but one thing I need help with is that I need a separate link inside the expanded div to close it with. (a button that says hide). How do I do that?

I tried using <a href="javascript:instance.sweepToggle('contract')">Hide</a>

this works, however it will close ALL the boxes in the instance and I only need one closed. Appreciated greatly.