some control-sidebar fixes

- removed setMargin in js
- fixed control-sidebar slide animate step
- added zindex-contro-sidebar
- added control-sidebar-push class
- updated zindex's
pull/2197/head
REJack 2019-08-13 14:26:25 +02:00
parent 0876d0ab70
commit c4c082c4ac
No known key found for this signature in database
GPG Key ID: 9F3976CC630CC888
5 changed files with 47 additions and 24 deletions

View File

@ -55,9 +55,9 @@ const ControlSidebar = (($) => {
// Show the control sidebar // Show the control sidebar
if (this._config.controlsidebarSlide) { if (this._config.controlsidebarSlide) {
$('html').addClass(ClassName.CONTROL_SIDEBAR_ANIMATE) $('html').addClass(ClassName.CONTROL_SIDEBAR_ANIMATE)
$('body').removeClass(ClassName.CONTROL_SIDEBAR_SLIDE).delay(50).queue(function(){ $('body').removeClass(ClassName.CONTROL_SIDEBAR_SLIDE).delay(300).queue(function(){
$(Selector.CONTROL_SIDEBAR).hide()
$('html').removeClass(ClassName.CONTROL_SIDEBAR_ANIMATE) $('html').removeClass(ClassName.CONTROL_SIDEBAR_ANIMATE)
$(Selector.CONTROL_SIDEBAR).fadeOut()
$(this).dequeue() $(this).dequeue()
}) })
} else { } else {
@ -72,8 +72,8 @@ const ControlSidebar = (($) => {
// Collapse the control sidebar // Collapse the control sidebar
if (this._config.controlsidebarSlide) { if (this._config.controlsidebarSlide) {
$('html').addClass(ClassName.CONTROL_SIDEBAR_ANIMATE) $('html').addClass(ClassName.CONTROL_SIDEBAR_ANIMATE)
$(Selector.CONTROL_SIDEBAR).show().delay(50).queue(function(){ $(Selector.CONTROL_SIDEBAR).show().delay(10).queue(function(){
$('body').addClass(ClassName.CONTROL_SIDEBAR_SLIDE).delay(50).queue(function(){ $('body').addClass(ClassName.CONTROL_SIDEBAR_SLIDE).delay(300).queue(function(){
$('html').removeClass(ClassName.CONTROL_SIDEBAR_ANIMATE) $('html').removeClass(ClassName.CONTROL_SIDEBAR_ANIMATE)
$(this).dequeue() $(this).dequeue()
}) })
@ -88,8 +88,6 @@ const ControlSidebar = (($) => {
} }
toggle() { toggle() {
this._setMargin()
const shouldOpen = $('body').hasClass(ClassName.CONTROL_SIDEBAR_OPEN) || $('body') const shouldOpen = $('body').hasClass(ClassName.CONTROL_SIDEBAR_OPEN) || $('body')
.hasClass(ClassName.CONTROL_SIDEBAR_SLIDE) .hasClass(ClassName.CONTROL_SIDEBAR_SLIDE)
if (shouldOpen) { if (shouldOpen) {
@ -107,12 +105,6 @@ const ControlSidebar = (($) => {
return $.extend({}, Default, config) return $.extend({}, Default, config)
} }
_setMargin() {
$(Selector.CONTROL_SIDEBAR).css({
top: $(Selector.MAIN_HEADER).innerHeight()
})
}
// Static // Static
static _jQueryInterface(operation) { static _jQueryInterface(operation) {

View File

@ -9,7 +9,7 @@ html.control-sidebar-animate {
.control-sidebar { .control-sidebar {
position: absolute; position: absolute;
top: $main-header-height; top: $main-header-height;
z-index: 830; z-index: $zindex-control-sidebar;
&, &,
&::before { &::before {
@ -17,11 +17,11 @@ html.control-sidebar-animate {
display: none; display: none;
right: -$control-sidebar-width; right: -$control-sidebar-width;
width: $control-sidebar-width; width: $control-sidebar-width;
@include transition(right $transition-speed $transition-fn); @include transition(right $transition-speed $transition-fn, display $transition-speed $transition-fn);
} }
&::before { &::before {
content: " "; content: '';
display: block; display: block;
position: fixed; position: fixed;
top: 0; top: 0;
@ -29,6 +29,13 @@ html.control-sidebar-animate {
} }
} }
.control-sidebar-push {
.content-wrapper,
.main-footer {
@include transition(margin-right $transition-speed $transition-fn);
}
}
// Control sidebar open state // Control sidebar open state
.control-sidebar-open { .control-sidebar-open {
@include media-breakpoint-up(md) { @include media-breakpoint-up(md) {
@ -41,11 +48,13 @@ html.control-sidebar-animate {
} }
} }
&.control-sidebar-push {
.content-wrapper, .content-wrapper,
.main-footer { .main-footer {
margin-right: $control-sidebar-width; margin-right: $control-sidebar-width;
} }
} }
}
@include media-breakpoint-down(md) { @include media-breakpoint-down(md) {
.control-sidebar { .control-sidebar {
@ -65,6 +74,14 @@ html.control-sidebar-animate {
&, &,
&::before { &::before {
right: 0; right: 0;
@include transition(right $transition-speed $transition-fn, display $transition-speed $transition-fn);
}
}
&.control-sidebar-push {
.content-wrapper,
.main-footer {
margin-right: $control-sidebar-width;
} }
} }
} }

View File

@ -47,6 +47,10 @@ body,
} }
.layout-navbar-fixed & { .layout-navbar-fixed & {
.control-sidebar {
top: 0;
}
a.anchor { a.anchor {
display: block; display: block;
position: relative; position: relative;
@ -119,6 +123,10 @@ body,
} }
.layout#{$infix}-navbar-fixed & { .layout#{$infix}-navbar-fixed & {
.control-sidebar {
top: 0;
}
a.anchor { a.anchor {
display: block; display: block;
position: relative; position: relative;
@ -197,7 +205,7 @@ body,
left: 0; left: 0;
position: fixed; position: fixed;
right: 0; right: 0;
z-index: $zindex-main-sidebar - 1; z-index: $zindex-main-footer;
} }
} }
@ -221,7 +229,7 @@ body,
left: 0; left: 0;
position: fixed; position: fixed;
right: 0; right: 0;
z-index: $zindex-main-sidebar - 1; z-index: $zindex-main-footer;
} }
.content-wrapper { .content-wrapper {

View File

@ -152,8 +152,10 @@ $attachment-border-radius: 3px !default;
// Z-INDEX // Z-INDEX
// -------------------------------------------------------- // --------------------------------------------------------
$zindex-main-header: $zindex-fixed + 2 !default; $zindex-main-header: $zindex-fixed + 4 !default;
$zindex-main-sidebar: $zindex-fixed + 6 !default; $zindex-main-sidebar: $zindex-fixed + 8 !default;
$zindex-main-footer: $zindex-fixed + 1 !default;
$zindex-control-sidebar: $zindex-fixed + 2 !default;
$zindex-sidebar-mini-links: 010 !default; $zindex-sidebar-mini-links: 010 !default;
// TRANSITIONS SETTINGS // TRANSITIONS SETTINGS

View File

@ -7,6 +7,10 @@ Control sidebar is the right sidebar. It can be used for many purposes and is ex
The following code should be placed within the `.wrapper` div. I prefer to place it right after the footer. The following code should be placed within the `.wrapper` div. I prefer to place it right after the footer.
##### Control Sidebar Push
{: .text-bold .text-dark}
By adding the `.control-sidebar-push` to `body`, the sidebar pushes the content away instead of overlaying the content.
##### Dark Sidebar Markup ##### Dark Sidebar Markup
{: .text-bold .text-dark} {: .text-bold .text-dark}
```html ```html