forked from projectcalico/calico
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
executable file
·31 lines (27 loc) · 1.24 KB
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
$(document).ready(function(){
// remove anchor hash from page url if present
var pathname = location.href.split('#')[0];
// Open any collapses that should be opened when the page loads
$('#sidebar a').each(function () {
if (pathname === this.href) {
$(this).parents('div.collapse').each(function(){
// Toggling will show animation on pageload. instead, just add CSS class
$(this).addClass("in");
$(this).parent().prev().find('span.glyphicon').removeClass('glyphicon-chevron-right').addClass('glyphicon-chevron-down');
});
$(this).parent().addClass('current-page');
this.onclick = function(e){e.preventDefault();};
}
});
// Make arrows switch direction on collapse.
$('#sidebar').on('show.bs.collapse', function(event) {
$(event.target).parent().prev().find('span.glyphicon').removeClass('glyphicon-chevron-right').addClass('glyphicon-chevron-down');
});
$('#sidebar').on('hide.bs.collapse', function(event) {
$(event.target).parent().prev().find('span.glyphicon').removeClass('glyphicon-chevron-down').addClass('glyphicon-chevron-right');
})
// Enable the sidebar collapse
$('[data-toggle="offcanvas"]').click(function () {
$('.row-offcanvas').toggleClass('active')
});
});