diff options
author | Jacob Schatz <jacobschatz@Jacobs-MBP.fios-router.home> | 2016-02-04 16:50:25 +0300 |
---|---|---|
committer | Jacob Schatz <jacobschatz@Jacobs-MBP.fios-router.home> | 2016-02-04 16:50:25 +0300 |
commit | f25ba6e03c6635b75a46e6f53c3cfee8109b74f9 (patch) | |
tree | 25fbdb688bef167034b0513e97b3410f5e61fd27 | |
parent | e0efdc4bf759ed8129d12aed16e68fb7392eddc7 (diff) |
Resize sidebar on initial page refresh.
-rw-r--r-- | app/assets/javascripts/application.js.coffee | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/app/assets/javascripts/application.js.coffee b/app/assets/javascripts/application.js.coffee index 1abc4794f21..b7c465401be 100644 --- a/app/assets/javascripts/application.js.coffee +++ b/app/assets/javascripts/application.js.coffee @@ -269,11 +269,19 @@ $ -> '<div class="device-lg visible-lg"></div>') checkBootstrapBreakpoints() - $(window).on "resize", (e) -> + fitSidebarForSize = -> oldBootstrapBreakpoint = bootstrapBreakpoint checkBootstrapBreakpoints() if bootstrapBreakpoint != oldBootstrapBreakpoint - $(document).trigger('breakpoint:change',[bootstrapBreakpoint]) + $(document).trigger('breakpoint:change', [bootstrapBreakpoint]) + + checkInitialSidebarSize = -> + if bootstrapBreakpoint is "xs" or "sm" + $(document).trigger('breakpoint:change', [bootstrapBreakpoint]) + + $(window).on "resize", (e) -> + fitSidebarForSize() setBootstrapBreakpoints() + checkInitialSidebarSize() new Aside() |