Skip to content

Commit

Permalink
Item14219: Check in PatternSkinCssCookbookSidebarToggle
Browse files Browse the repository at this point in the history
Not adding to MANIFEST or linking documentation yet. CSS needs review /
cleanup.
  • Loading branch information
gac410 committed Nov 18, 2016
1 parent 9884d56 commit f87da94
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 0 deletions.
34 changes: 34 additions & 0 deletions PatternSkin/data/System/PatternSkinCssCookbookSidebarToggle.txt
@@ -0,0 +1,34 @@
%META:TOPICINFO{author="ProjectContributor" date="1479429261" format="1.1" version="1"}%
%META:TOPICPARENT{name="System.PatternSkinCssCookbook"}%
<!--
* Set NOWYSIWYG = 1
-->
---+!! System.PatternSkinCssCookbook Recipe: Left Sidebar Toggle
(currently this Topic is in the Web [[Sandbox.StefanKrüger.WebHome][Sandbox.StefanKrüger]])

Idea/Target:
currently the Sidebar is hidden for screens with width < 870px
this mod shoud allow to toggle the sidebar at small screens..

<div class="foswikiHelp">
This line loads the extra style definition:
<verbatim class="tml">
* Set USERSTYLEURL = %PUBURLPATH{topic="Sandbox.StefanKrüger.PatternSkinCssCookbookSidebarToggle" "SidebarToggle.css"}%
</verbatim>
You can write these lines in %SYSTEMWEB%.%WIKIPREFSTOPIC%, in %LOCALSITEPREFS%, in %WEBPREFSTOPIC%, in your user topic, or on a single page.

To Add the Button to the Sidebar do the following:
Add a Macro
<verbatim class="tml">
* Set SIDEBARTOGGLEBUTTON = <button class="sidebartoggle-button" onclick="$('body').toggleClass('showsidebar');">toggle</button>
</verbatim>
then you can use this in a topic or in the System.WebLeftBarWebsList to add it globaly.<br>
the formating/positioning is done in the css. if the button is part of the sidbar it will be positioned absolute so it
</div>
<!-- %JQREQUIRE{"chili"}% -->

test button: %SIDEBARTOGGLEBUTTON% <br>
this button only works if the sidebar is hidden (screen-width < 870px)

(this is based on [[System.PatternSkinCssCookbookNoLeftBar]])
%META:FILEATTACHMENT{name="SidebarToggle.css" attachment="SidebarToggle.css" attr="" comment="StyleSheet to toggle left Sidebar in the PatternSkin" date="1479429261" size="784" user="ProjectContributor" version="1"}%
@@ -0,0 +1,39 @@
/* Sidebar Toggle */

button.sidebartoggle-button {
/* here comes some default formating */
}

/* if button is in sidebar and display is wide enough hide it. */
#patternSideBar button.sidebartoggle-button {
display: none;
}

/* for nice smooth effects: */
#patternSideBar {
display:block;
}
#patternOuter {
transition: margin-left ease-in-out 0.5s;
}

/* only active if normally hidden: */
@media(max-width:870px) {
body.showsidebar #patternOuter {
margin-left: 16em;
transition: margin-left ease-in-out 0.5s;
}

/* show button */
#patternSideBar button.sidebartoggle-button {
display: block;
position: fixed;
left: 0;
bottom: 0;
width: 2em;
height: 2em;
border-radius: 0.5em;
border: solid 2px rgba(0,0,0, 0.4);
background-color: rgba(0,0,0, 0.3);
}
}

0 comments on commit f87da94

Please sign in to comment.