Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Hide sidebar if #sidebar has no children pixel-cookers#29
From huandu:master
  • Loading branch information
vsc55 committed Oct 8, 2019
1 parent 8d0aded commit d3dc096
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions javascripts/theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,16 @@

sidebar_btn.on('click', toggle_sidebar);

if (elem != undefined){
elem.before(sidebar_btn);
if ($.cookie('hide_sidebar') == 'yes'){
$('#main').toggleClass('nosidebar');
if (elem.length){
// show sidebar if it has something.
if ($("#sidebar").children().length) {
elem.before(sidebar_btn);
if ($.cookie('hide_sidebar') == 'yes'){
$('#main').toggleClass('nosidebar');
}
} else {
// if #sidebar is empty, hide it completely.
$("#main").toggleClass("nosidebar");
}
}

Expand Down

0 comments on commit d3dc096

Please sign in to comment.