mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-10-02 18:04:29 +08:00
Remove auto-toggling of navigation sidebar depending on width
This commit is contained in:
parent
8b527d8a5b
commit
b86edf20a5
3 changed files with 11 additions and 17 deletions
|
@ -227,27 +227,15 @@ function setupSidebarTree() {
|
|||
|
||||
// Resize the sidebar to accomodate to the page size
|
||||
function resizeSidebarContents() {
|
||||
var wrapper = $("#wrapper");
|
||||
var tree = $("#sidebar-wrapper .tree");
|
||||
var toggled = true;
|
||||
var navbar = $(".navbar-secondary");
|
||||
|
||||
// Set vertical scrollbar on navigation tree
|
||||
if (tree.length && tree.length == 1) {
|
||||
tree.css(
|
||||
"height",
|
||||
($(window).height() - tree.position().top - 50) + "px"
|
||||
);
|
||||
}
|
||||
// Automatic toggling of sidebar for smaller devices
|
||||
if (toggled === null) {
|
||||
if ($(window).width() < <%= Constants::SCREEN_WIDTH_LARGE %>) {
|
||||
wrapper.addClass("toggled");
|
||||
navbar.addClass("navbar-without-sidebar");
|
||||
} else {
|
||||
wrapper.removeClass("toggled");
|
||||
navbar.removeClass("navbar-without-sidebar");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
(function () {
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
$('.navbar-secondary').css(
|
||||
{ 'margin-left': '-280px', 'padding-left': '294px' }
|
||||
);
|
||||
$('#sideBarButton').attr('data-shown', '');
|
||||
}
|
||||
|
||||
function hide() {
|
||||
|
@ -25,23 +26,28 @@
|
|||
'margin-left': '0',
|
||||
'padding-left': '14px'
|
||||
});
|
||||
$('#sideBarButton').removeAttr('data-shown');
|
||||
}
|
||||
|
||||
function toggle() {
|
||||
var btn = $('#sideBarButton');
|
||||
if (btn.is('[data-shown]')) {
|
||||
btn.removeAttr('data-shown');
|
||||
hide();
|
||||
} else {
|
||||
btn.attr('data-shown', '');
|
||||
show();
|
||||
}
|
||||
}
|
||||
|
||||
function isShown() {
|
||||
var btn = $('#sideBarButton');
|
||||
return btn.is('[data-shown]');
|
||||
}
|
||||
|
||||
return Object.freeze({
|
||||
show: show,
|
||||
hide: hide,
|
||||
toggle: toggle
|
||||
toggle: toggle,
|
||||
isShown: isShown
|
||||
})
|
||||
})();
|
||||
})(window);
|
||||
|
|
|
@ -96,7 +96,7 @@ class Constants
|
|||
|
||||
# Screen width which is still suitable for sidebar to be shown, otherwise
|
||||
# hidden
|
||||
SCREEN_WIDTH_LARGE = 928
|
||||
SCREEN_WIDTH_LARGE = 768
|
||||
|
||||
#=============================================================================
|
||||
# Styling
|
||||
|
|
Loading…
Add table
Reference in a new issue