Skip to main content

Our topics tend to be wordy and include lengthly samples of code. Users have asked if we could include an arrow to collapse the right sidebar, freeing up the space to make posts easier to read.

 

Has anyone created this type of functionality?  

You can do this with some javascript….but I haven’t done it myself.

The sidebar class you will need to update the styles for is….

.col--side

Adding….

display: none;

...to the style will hide that.

The main post section can have its style changed using this class path…

.col--main.has--side

Changing the width from this….
 

width: calc(100% - 384px);


...to this….
 

width: 100%;
 

...will increase its size to replace the space left by the sidebar.

To do this you will need to create a button, checkbox or something else to trigger the change.  The Javascript you will need to add can go in the “Third Party Scripts”.

As I said, I haven’t actually done this (I might give it a go though, as it is a nice idea), so can’t give you the code at the moment. 


Thanks @rhall - I’ll give it a try and let you know. 


Reply