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

View File

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

View File

@ -1,26 +1,24 @@
@require 'variables' @require 'variables'
.page-wrapper { .page-wrapper {
padding-left: $sidebar-width
box-sizing: border-box box-sizing: border-box
min-height: 100% min-height: 100%
width: 100%
// Animation: slide away // Animation: slide away
transition: padding-left 0.5s, margin-right 0.5s transition: padding-left 0.5s, margin-left 0.5s
@media only screen and (max-width: $max-page-width-with-hidden-sidebar) {
padding-left: 0
}
}
.sidebar-hidden .page-wrapper {
padding-left: 0
} }
.sidebar-visible .page-wrapper { .sidebar-visible .page-wrapper {
padding-left: $sidebar-width 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 { .page {
@ -30,7 +28,7 @@
.content { .content {
margin-left: auto margin-left: auto
margin-right:auto margin-right: auto
max-width: $content-max-width max-width: $content-max-width
padding-bottom: 50px padding-bottom: 50px

View File

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