BigW Consortium Gitlab

sidebar.js.coffee 743 Bytes
Newer Older
1 2
collapsed = 'page-sidebar-collapsed'
expanded = 'page-sidebar-expanded'
3

4
toggleSidebar = ->
5
  $('.page-with-sidebar').toggleClass("#{collapsed} #{expanded}")
6
  $('header').toggleClass("header-collapsed header-expanded")
7
  $('.toggle-nav-collapse i').toggleClass("fa-angle-right fa-angle-left")
8
  $.cookie("collapsed_nav", $('.page-with-sidebar').hasClass(collapsed), { path: '/' })
9 10 11 12 13 14

  setTimeout ( ->
    niceScrollBars = $('.nicescroll').niceScroll();
    niceScrollBars.updateScrollBar();
  ), 300

15 16 17 18
$(document).on("click", '.toggle-nav-collapse', (e) ->
  e.preventDefault()

  toggleSidebar()
19
)
20

21
$ ->
Phil Hughes committed
22
  size = bp.getBreakpointSize()
23 24

  if size is "xs" or size is "sm"
25 26
    if $('.page-with-sidebar').hasClass(expanded)
      toggleSidebar()