Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e7212c3

Browse files
committed
adds new .sidebar-overlay modifier class for keeping the drawer over the content when toggled
1 parent a81e303 commit e7212c3

File tree

3 files changed

+48
-1
lines changed

3 files changed

+48
-1
lines changed

README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,27 @@ Reverse the page orientation with a single class.
7878
```
7979

8080

81+
### Sidebar overlay instead of push
82+
83+
Make the sidebar overlap the viewport content with a single class:
84+
85+
```html
86+
<body class="sidebar-overlay">
87+
...
88+
</body>
89+
```
90+
91+
This will keep the content stationary and slide in the sidebar over the side content. It also adds a `box-shadow` based outline to the toggle for contrast against backgrounds, as well as a `box-shadow` on the sidebar for depth.
92+
93+
It's also available for a reversed layout when you add both classes:
94+
95+
```html
96+
<body class="layout-reverse sidebar-overlay">
97+
...
98+
</body>
99+
```
100+
101+
81102
## Development
82103

83104
Lanyon has two branches, but only one is used for active development.

_layouts/default.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
{% include head.html %}
55

6-
<body>
6+
<body class="layout-reverse sidebar-overlay">
77

88
{% include sidebar.html %}
99

public/css/lanyon.css

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,7 @@ a.sidebar-nav-item:focus {
278278
}
279279

280280
#sidebar-checkbox:checked + .sidebar {
281+
z-index: 10;
281282
visibility: visible;
282283
}
283284
#sidebar-checkbox:checked ~ .sidebar,
@@ -525,3 +526,28 @@ a.pagination-item:hover {
525526
.theme-base-0f .related-posts li a:hover {
526527
color: #8f5536;
527528
}
529+
530+
531+
/*
532+
* Overlay sidebar
533+
*
534+
* Make the sidebar content overlay the viewport content instead of pushing it
535+
* aside when toggled.
536+
*/
537+
538+
.sidebar-overlay #sidebar-checkbox:checked ~ .wrap {
539+
-webkit-transform: translateX(0);
540+
-ms-transform: translateX(0);
541+
transform: translateX(0);
542+
}
543+
.sidebar-overlay #sidebar-checkbox:checked ~ .sidebar-toggle {
544+
box-shadow: 0 0 0 .25rem #fff;
545+
}
546+
.sidebar-overlay #sidebar-checkbox:checked ~ .sidebar {
547+
box-shadow: .25rem 0 .5rem rgba(0,0,0,.1);
548+
}
549+
550+
/* Only one tweak for a reverse layout */
551+
.layout-reverse.sidebar-overlay #sidebar-checkbox:checked ~ .sidebar {
552+
box-shadow: -.25rem 0 .5rem rgba(0,0,0,.1);
553+
}

0 commit comments

Comments
 (0)