Avoid resizing page/content on sidebar toggle

This commit is contained in:
Shane Nelson 2017-12-17 22:53:25 -05:00
parent 65acb355d7
commit 6e90e520d6
4 changed files with 26 additions and 28 deletions

View File

@ -6,6 +6,7 @@ body {
body {
margin: 0;
font-size: 1rem;
overflow-x: hidden;
}
code {
font-family: "Source Code Pro", Consolas, "Ubuntu Mono", Menlo, "DejaVu Sans Mono", monospace, monospace;
@ -109,28 +110,25 @@ table thead td {
white-space: nowrap;
}
.page-wrapper {
padding-left: 300px;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
min-height: 100%;
-webkit-transition: padding-left 0.5s, margin-right 0.5s;
-moz-transition: padding-left 0.5s, margin-right 0.5s;
-o-transition: padding-left 0.5s, margin-right 0.5s;
-ms-transition: padding-left 0.5s, margin-right 0.5s;
transition: padding-left 0.5s, margin-right 0.5s;
}
@media only screen and (max-width: 1060px) {
.page-wrapper {
padding-left: 0;
}
}
.sidebar-hidden .page-wrapper {
padding-left: 0;
width: 100%;
-webkit-transition: padding-left 0.5s, margin-left 0.5s;
-moz-transition: padding-left 0.5s, margin-left 0.5s;
-o-transition: padding-left 0.5s, margin-left 0.5s;
-ms-transition: padding-left 0.5s, margin-left 0.5s;
transition: padding-left 0.5s, margin-left 0.5s;
}
.sidebar-visible .page-wrapper {
padding-left: 300px;
margin-right: -300px;
}
@media only screen and (max-width: 1079px) {
.sidebar-visible .page-wrapper {
padding-left: 0;
margin-left: 300px;
}
}
.page {
outline: 0;

View File

@ -6,6 +6,7 @@ html, body {
body {
margin: 0;
font-size: 1rem;
overflow-x: hidden
}
code {

View File

@ -1,26 +1,24 @@
@require 'variables'
.page-wrapper {
padding-left: $sidebar-width
box-sizing: border-box
min-height: 100%
width: 100%
// Animation: slide away
transition: padding-left 0.5s, margin-right 0.5s
@media only screen and (max-width: $max-page-width-with-hidden-sidebar) {
padding-left: 0
}
}
.sidebar-hidden .page-wrapper {
padding-left: 0
transition: padding-left 0.5s, margin-left 0.5s
}
.sidebar-visible .page-wrapper {
padding-left: $sidebar-width
margin-right: - $sidebar-width
}
@media only screen and (max-width: $page-plus-sidebar-width - 1) {
.sidebar-visible .page-wrapper {
padding-left: 0
margin-left: $sidebar-width
}
}
.page {

View File

@ -1,4 +1,5 @@
$sidebar-width = 300px
$page-padding = 15px
$max-page-width-with-hidden-sidebar = 1060px
$content-max-width = 750px
$max-page-width-with-hidden-sidebar = 1060px
$page-plus-sidebar-width = $content-max-width + $sidebar-width + $page-padding * 2