Browse Source

now layouts or pages can specify "sidebar: collapse" in the yaml front matter for an always collapsed sidebar

unreleased_contents
Brandon Mathis 13 years ago
parent
commit
eade4fc0d5
  1. 2
      .themes/classic/source/_layouts/default.html
  2. 20
      .themes/classic/source/javascripts/octopress.js

2
.themes/classic/source/_layouts/default.html

@ -1,6 +1,6 @@
{% capture root_url %}{{ site.root | strip_slash }}{% endcapture %}
{% include head.html %}
<body {% if page.body_id %} id="{{ page.body_id }}" {% endif %} {% if page.sidebar == false %} class="no-sidebar" {% endif %}>
<body {% if page.body_id %} id="{{ page.body_id }}" {% endif %} {% if page.sidebar == false %} class="no-sidebar" {% endif %} {% if page.sidebar == 'collapse' %} class="collapse-sidebar sidebar-footer" {% endif %}>
<header role="banner">{% include header.html %}</header>
<nav role="navigation">{% include navigation.html %}</nav>
<div id="main">

20
.themes/classic/source/javascripts/octopress.js

@ -11,15 +11,17 @@ function getNav() {
}
function addSidebarToggler() {
$('#content').append('<span class="toggle-sidebar"></span>');
$('.toggle-sidebar').bind('click', function(e) {
e.preventDefault();
if ($('body').hasClass('collapse-sidebar')) {
$('body').removeClass('collapse-sidebar');
} else {
$('body').addClass('collapse-sidebar');
}
});
if(!$('body').hasClass('sidebar-footer')) {
$('#content').append('<span class="toggle-sidebar"></span>');
$('.toggle-sidebar').bind('click', function(e) {
e.preventDefault();
if ($('body').hasClass('collapse-sidebar')) {
$('body').removeClass('collapse-sidebar');
} else {
$('body').addClass('collapse-sidebar');
}
});
}
var sections = $('aside.sidebar > section');
if (sections.length > 1) {
sections.each(function(section, index){

Loading…
Cancel
Save