I have put together product documentation using the documentation theme and link to individual articles from different parts of the product. In some cases, I want the sidebar to be expanded and in other cases I want the sidebar to be hidden, depending on which page the article is linked from and how big the window will be.
The logical way to accomplish this would be to include some kind of flag to indicate whether the sidebar should be shown or hidden:
http://{article_link}?show_sidebar=1
I couldn't see an obvious way to do this, so I was curious to see if this seemed feasible to anyone.
You could do something like this. I would add it to the "At end of the BODY" section of the Custom HTML page in Confluence Admin.
<script type="text/javascript"> AJS.toInit(function () { var show = getParameterByName('show_sidebar'); var splitPos = AJS.$('#splitter .vsplitbar').css('left') if((show === '1' && splitPos === '0px') || (show === '0' && splitPos != '0px')) { AJS.$('#splitter-button').click(); } }); function getParameterByName(name) { name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]"); var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"), results = regex.exec(location.search); return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " ")); } </script>
Did this work for you?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.