Commit 178be67d authored by Annabel Dunstone Gray's avatar Annabel Dunstone Gray

Set height of fixed sidebars with js

parent 647d2b08
...@@ -35,13 +35,16 @@ ...@@ -35,13 +35,16 @@
window.innerWidth >= sidebarBreakpoint && window.innerWidth >= sidebarBreakpoint &&
$(pageSelector).hasClass(expandedPageClass) $(pageSelector).hasClass(expandedPageClass)
); );
$(window).on('resize', () => this.setSidebarHeight());
$(document) $(document)
.on('click', sidebarToggleSelector, () => this.toggleSidebar()) .on('click', sidebarToggleSelector, () => this.toggleSidebar())
.on('click', pinnedToggleSelector, () => this.togglePinnedState()) .on('click', pinnedToggleSelector, () => this.togglePinnedState())
.on('click', 'html, body, a, button', (e) => this.handleClickEvent(e)) .on('click', 'html, body, a, button', (e) => this.handleClickEvent(e))
.on('DOMContentLoaded', () => this.renderState()) .on('DOMContentLoaded', () => this.renderState())
.on('scroll', () => this.setSidebarHeight())
.on('todo:toggle', (e, count) => this.updateTodoCount(count)); .on('todo:toggle', (e, count) => this.updateTodoCount(count));
this.renderState(); this.renderState();
this.setSidebarHeight();
} }
handleClickEvent(e) { handleClickEvent(e) {
...@@ -64,6 +67,14 @@ ...@@ -64,6 +67,14 @@
this.renderState(); this.renderState();
} }
setSidebarHeight() {
const $navHeight = $('.navbar-gitlab').outerHeight() + $('.layout-nav').outerHeight();
const diff = $navHeight - $('body').scrollTop();
if (diff > 0) {
$('.right-sidebar').outerHeight($(window).height() - diff);
}
}
togglePinnedState() { togglePinnedState() {
this.isPinned = !this.isPinned; this.isPinned = !this.isPinned;
if (!this.isPinned) { if (!this.isPinned) {
......
...@@ -190,7 +190,6 @@ ...@@ -190,7 +190,6 @@
.right-sidebar { .right-sidebar {
position: absolute; position: absolute;
height: 100%;
top: $header-height; top: $header-height;
bottom: 0; bottom: 0;
right: 0; right: 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment