未验证 提交 7b6e000d 编写于 作者: R REJack

fixed control-sidebar slide option

- renamed `slide` to `controlsidebarSlide` to avoid bootstrap js error
- reworked js to get slide false working without transition
- added .control-sidebar-hold-transition
上级 d3a213af
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
var DataKey = 'lte.controlsidebar'; var DataKey = 'lte.controlsidebar';
var Default = { var Default = {
slide: true controlsidebarSlide: true
}; };
var Selector = { var Selector = {
...@@ -26,7 +26,8 @@ ...@@ -26,7 +26,8 @@
}; };
var ClassName = { var ClassName = {
open : 'control-sidebar-open', open: 'control-sidebar-open',
transition: 'control-sidebar-hold-transition',
fixed: 'fixed' fixed: 'fixed'
}; };
...@@ -72,8 +73,11 @@ ...@@ -72,8 +73,11 @@
ControlSidebar.prototype.expand = function () { ControlSidebar.prototype.expand = function () {
$(Selector.sidebar).show(); $(Selector.sidebar).show();
if (!this.options.slide) { if (!this.options.controlsidebarSlide) {
$('body').addClass(ClassName.open); $('body').addClass(ClassName.transition).addClass(ClassName.open).delay(50).queue(function(){
$('body').removeClass(ClassName.transition);
$(this).dequeue()
})
} else { } else {
$(Selector.sidebar).addClass(ClassName.open); $(Selector.sidebar).addClass(ClassName.open);
} }
...@@ -83,7 +87,14 @@ ...@@ -83,7 +87,14 @@
}; };
ControlSidebar.prototype.collapse = function () { ControlSidebar.prototype.collapse = function () {
$('body, ' + Selector.sidebar).removeClass(ClassName.open); if (!this.options.controlsidebarSlide) {
$('body').addClass(ClassName.transition).removeClass(ClassName.open).delay(50).queue(function(){
$('body').removeClass(ClassName.transition);
$(this).dequeue()
})
} else {
$(Selector.sidebar).removeClass(ClassName.open);
}
$(Selector.sidebar).fadeOut(); $(Selector.sidebar).fadeOut();
$(this.element).trigger($.Event(Event.collapsed)); $(this.element).trigger($.Event(Event.collapsed));
}; };
......
...@@ -41,6 +41,14 @@ ...@@ -41,6 +41,14 @@
} }
// Open without slide over content // Open without slide over content
.control-sidebar-hold-transition {
.control-sidebar-bg,
.control-sidebar,
.content-wrapper {
transition: none;
}
}
.control-sidebar-open { .control-sidebar-open {
.control-sidebar-bg, .control-sidebar-bg,
.control-sidebar { .control-sidebar {
......
...@@ -748,6 +748,11 @@ a:focus { ...@@ -748,6 +748,11 @@ a:focus {
.control-sidebar.control-sidebar-open + .control-sidebar-bg { .control-sidebar.control-sidebar-open + .control-sidebar-bg {
right: 0; right: 0;
} }
.control-sidebar-hold-transition .control-sidebar-bg,
.control-sidebar-hold-transition .control-sidebar,
.control-sidebar-hold-transition .content-wrapper {
transition: none;
}
.control-sidebar-open .control-sidebar-bg, .control-sidebar-open .control-sidebar-bg,
.control-sidebar-open .control-sidebar { .control-sidebar-open .control-sidebar {
right: 0; right: 0;
......
因为 它太大了无法显示 source diff 。你可以改为 查看blob
...@@ -749,6 +749,11 @@ a:focus { ...@@ -749,6 +749,11 @@ a:focus {
.control-sidebar.control-sidebar-open + .control-sidebar-bg { .control-sidebar.control-sidebar-open + .control-sidebar-bg {
right: 0; right: 0;
} }
.control-sidebar-hold-transition .control-sidebar-bg,
.control-sidebar-hold-transition .control-sidebar,
.control-sidebar-hold-transition .content-wrapper {
transition: none;
}
.control-sidebar-open .control-sidebar-bg, .control-sidebar-open .control-sidebar-bg,
.control-sidebar-open .control-sidebar { .control-sidebar-open .control-sidebar {
right: 0; right: 0;
......
...@@ -329,7 +329,7 @@ throw new Error('AdminLTE requires jQuery') ...@@ -329,7 +329,7 @@ throw new Error('AdminLTE requires jQuery')
var DataKey = 'lte.controlsidebar'; var DataKey = 'lte.controlsidebar';
var Default = { var Default = {
slide: true controlsidebarSlide: true
}; };
var Selector = { var Selector = {
...@@ -343,7 +343,8 @@ throw new Error('AdminLTE requires jQuery') ...@@ -343,7 +343,8 @@ throw new Error('AdminLTE requires jQuery')
}; };
var ClassName = { var ClassName = {
open : 'control-sidebar-open', open: 'control-sidebar-open',
transition: 'control-sidebar-hold-transition',
fixed: 'fixed' fixed: 'fixed'
}; };
...@@ -389,8 +390,11 @@ throw new Error('AdminLTE requires jQuery') ...@@ -389,8 +390,11 @@ throw new Error('AdminLTE requires jQuery')
ControlSidebar.prototype.expand = function () { ControlSidebar.prototype.expand = function () {
$(Selector.sidebar).show(); $(Selector.sidebar).show();
if (!this.options.slide) { if (!this.options.controlsidebarSlide) {
$('body').addClass(ClassName.open); $('body').addClass(ClassName.transition).addClass(ClassName.open).delay(50).queue(function(){
$('body').removeClass(ClassName.transition);
$(this).dequeue()
})
} else { } else {
$(Selector.sidebar).addClass(ClassName.open); $(Selector.sidebar).addClass(ClassName.open);
} }
...@@ -400,7 +404,14 @@ throw new Error('AdminLTE requires jQuery') ...@@ -400,7 +404,14 @@ throw new Error('AdminLTE requires jQuery')
}; };
ControlSidebar.prototype.collapse = function () { ControlSidebar.prototype.collapse = function () {
$('body, ' + Selector.sidebar).removeClass(ClassName.open); if (!this.options.controlsidebarSlide) {
$('body').addClass(ClassName.transition).removeClass(ClassName.open).delay(50).queue(function(){
$('body').removeClass(ClassName.transition);
$(this).dequeue()
})
} else {
$(Selector.sidebar).removeClass(ClassName.open);
}
$(Selector.sidebar).fadeOut(); $(Selector.sidebar).fadeOut();
$(this.element).trigger($.Event(Event.collapsed)); $(this.element).trigger($.Event(Event.collapsed));
}; };
......
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册