Skip to content

Instantly share code, notes, and snippets.

@rcmdnk
Created December 16, 2014 09:41
Show Gist options
  • Save rcmdnk/f916bc985c08c89312b9 to your computer and use it in GitHub Desktop.
Save rcmdnk/f916bc985c08c89312b9 to your computer and use it in GitHub Desktop.
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
function addSidebarToggler() {
if(!$('body').hasClass('sidebar-footer')) {
$('#content').append('<span class="toggle-sidebar"></span>');
$('.toggle-sidebar').bind('click', function(e) {
e.preventDefault();
$('body').toggleClass('collapse-sidebar');
});
}
var sections = $('aside.sidebar > section');
if (sections.length > 1) {
sections.each(function(index, section){
if ((sections.length >= 3) && index % 3 === 0) {
$(section).addClass("first");
}
var count = ((index +1) % 2) ? "odd" : "even";
$(section).addClass(count);
});
}
if (sections.length >= 3){ $('aside.sidebar').addClass('thirds'); }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment