1) Script Title: Switch Content Script II
2) Script URL (on DD):
http://www.dynamicdrive.com/dynamici...chcontent2.htm
3) Describe problem:
Id like the page to load with all the items contracted rather than expanded. How can I do this?
1) Script Title: Switch Content Script II
2) Script URL (on DD):
http://www.dynamicdrive.com/dynamici...chcontent2.htm
3) Describe problem:
Id like the page to load with all the items contracted rather than expanded. How can I do this?
Sure, simply edit function do_onload() inside the script with the below changes:
The code in red is new.Code:function do_onload(){ uniqueidn=window.location.pathname+"firsttimeload" var alltags=document.all? document.all : document.getElementsByTagName("*") ccollect=getElementbyClass(alltags, "switchcontent") statecollect=getElementbyClass(alltags, "showstate") if (enablepersist=="on" && get_cookie(window.location.pathname)!="" && ccollect.length>0) revivecontent() else sweeptoggle('contract') if (ccollect.length>0 && statecollect.length>0) revivestatus() }
Thanks alot![]()
Originally Posted by ddadmin
statecollect=getElementbyClass(alltags, "showstate")
if (enablepersist=="on" && get_cookie(window.location.pathname)!="" && ccollect.length>0)
revivecontent()
else
sweeptoggle('contract')
if (ccollect.length>0 && statecollect.length>0)
revivestatus()
}[/CODE]
Will you please explain, so that we understand, how this piece of code makes the menu contracted? What the if and else part is testing? I tried to understand, but I cannot at all. Please explain.
Thanks a lot for your time, I hope that you have time for this question..
It is testing whether persistence is on and whether the user has already been on the page(but it only tests that if persistence is on).
Well, the persistence feature supercedes the "contract all" feature, so when a visitor visits the page for the first time, the content are all contracted as they should be, but assuming persistence is enabled, on subsequent visits, the persistence feature takes over and recalls the last states of the contents.
I still have a question.
When you load a page all content is contracted but on load for a second you can see the content before its beeing contracted and it's kinda annoying.
So is it possible to load page without showing contracted content even for a part of second?
Bookmarks