PDA

View Full Version : How to make collapse closed by default?


bashy
11 Jan 2007, 18:27
Hi

I have this bit of code, It has a collapse feature and i would like to know how
to set the code so that the box is closed by default please?



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------

RyanIMC
11 Jan 2007, 21:17
I'm also looking for a way to do this

I've seen this,
http://www.vbulletin.org/forum/showthread.php?t=119931&highlight=collapsed+on+default but people without javascript cant reopen the box.

Or you could use this code after the box is created within the template that holds the box.



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



But if you use that, when you reload the page it simply toggles the box open and closed which is probably also not what people want.

We need a close('IDOfBoxToCollapse') :)

BigJohnny
11 Jan 2007, 22:05
no you just need some code in a template...

Here is one I use, it opens and closes when you click the arrow icon..

Replace all occurances of VARIABLE with whatever variable you choose to name it.

I dont know PHP all too well, so I dont know how you would work this into PHP but im sure you could figure something out.

you can see basically there is a a collapsable table, and the tbody which contains the information to be collapsed.

the rest is just a simple table template basically.... using another "bits" template for the content.



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



errr... sorry i misread the topic... so i may not have even answered your question... apologies for the wasted space :(

bashy
11 Jan 2007, 22:26
What i am after is having the box closed for default, any ideas, i already have the box and collapse objects

SirAdrian
11 Jan 2007, 22:28
In your template have it show the collapsed image by default, and also have the box with the following style applied:

Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------

bashy
12 Jan 2007, 07:06
Hi SirAdrian. The code that i have is in the 1st post, can you please advise where it would go in that code please?

Dismounted
12 Jan 2007, 09:47
Answered :)
http://www.vbulletin.org/forum/showthread.php?t=136063

bashy
12 Jan 2007, 17:32
Cheers dismounted ;)

reddyink
03 Nov 2007, 03:54
Thanks for collapsed style code
I added display:none style in my object. all rows are now collapsed by default. Is there a way that we can set first row to be expanded and all others to be collapsed. then user can click on collapsed one's to expand.

Can we set that option in same box, to first row to be expanded and all others to be collapsed when page loads.

Appreciate any help
Thanks