PDA

View Full Version : Sidebar collapse default


Jakub03
01-29-2012, 05:34 PM
So on the sidebar there is the different widgets
http://mypokerhub.com/forumdisplay.php?1-Welcome-to-My-Poker-Hub

Is is possible to make it so that all the widgets are collapsed on default? Where would i go to edit the code to make it do that or how could i make them automatically collapsed?

kh99
01-29-2012, 07:34 PM
The system is designed to default to expanded, and when a user collapses a block, the name of that block is listed in a cookie. Then when a page loads, a javascript function checks the vb_collapse cookie for a list of blocks that are collapsed and hides them. So you could modify the block_html template to default to collapsed, but since there's no js code that looks to expand collapsed blocks after the page loads, it will always load as collapsed.

You could write your own js to allow for default collapsed blocks, and modify the block_html template (I believe it's the class="collapse" that the built-in vb collpase system looks for). I don't thin k it would be too difficult (unless you don't know any js of course).

Jakub03
01-29-2012, 08:16 PM
And this would make the individual widgets in the sidebar be collapsed by default? I don't want the sidebar to be collapsed by default just the individual widgets inside it.

kh99
01-29-2012, 08:39 PM
Yes, I was talking about the individual widgets (actually I thought they were forum blocks). But I was suggesting you might have to write js to do it, so you could make it work for whichever parts you wanted.

Haponing
12-03-2012, 03:17 AM
Hi.

For some reason our forum block doesn't collapse if the collapse button is clicked. I'm thinking there's something wrong on the FORUMDISPLAY. Any help please?

sinucello
01-11-2013, 06:14 PM
Hi,

I also added some custom content to the sidebar and would like it to collapse just like the standard content.

So far I added

<vb:if condition="$close_sidebar"><p class="sidebar_hidden">Test collapsed<vb:else /><p class="custom_sidebar_stuff">Test not collapsed</p></vb:if>

to the FORUMHOME Template. This works but only if you reload the page.

To make the custom content collapse as soon as you click on the collapse button requires some modifications to:

forum/clientscript/vbulletin-sidebar.js

this file contains a toggle function:
vBSidebar.prototype.toggle_collapse=function(A){YA HOO.util.Event.stopEvent(A);if(YAHOO.util.Dom.getS tyle(this.sidebar,"display")=="none")

which sets the element with the ID sidebar to hidden. As CSS ID can only be used once you would have to add the IDs of your custom elements here. But my JavaScript skills are too limited to do so.

Would be great if someone could give me a hint on how to add additional IDs to the toggle_collapse function.

Thank you - all the best,
Sacha

WorldCraft
01-11-2013, 06:39 PM
Are you referring to the built in sidebar on the forumhome? Have you tried adding your content using the AdminCP -> Forums & Moderators -> Forum Blocks Manager?

Snowhog
07-29-2013, 07:26 PM
The system is designed to default to expanded, and when a user collapses a block, the name of that block is listed in a cookie. Then when a page loads, a javascript function checks the vb_collapse cookie for a list of blocks that are collapsed and hides them. So you could modify the block_html template to default to collapsed, but since there's no js code that looks to expand collapsed blocks after the page loads, it will always load as collapsed.

You could write your own js to allow for default collapsed blocks, and modify the block_html template (I believe it's the class="collapse" that the built-in vb collpase system looks for). I don't thin k it would be too difficult (unless you don't know any js of course).

vBulletin 4.2.1

You say that the system is designed to default to expanded, but in our forum, the sideblock is collapsed by default. I'd like to know where/how to change this so the sideblock is displayed by default.

Snowhog

Added:

Hmm. Okay, the sidebar does display un-collapsed to guests. I logged out and accessed our forum Home page without logging in, and see the sidebar fully open.

Why, as a logged in user, is the sidebar collapsed. Is it a setting within the AdminCP that I can change?

Added:

Ah, so it is cookie controlled! As the 'guest', and on the Home page and the sideblock displayed, I logged in. The sideblock remained displayed!

Live, experiment, and learn!! :)