Skip to content

Commit ec38133

Browse files
pradyunsgJon Wayne Parrott
authored and
Jon Wayne Parrott
committed
Use documentwrapper's height of sidebar (#9)
This is sort of a more correct thing to do since the first/last element of the body may have a margin that can cause the documentwrapper to be taller than bodywrapper. While this doesn't cause any major issues for this theme as is (due to the ample use of whitespace around the sidebar), this behaviour would help with derivative themes which remove the excessive margins on the sidebar.
1 parent f87d922 commit ec38133

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

python_docs_theme/static/sidebar.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ $(function() {
2828
var jwindow = $(window);
2929
var jdocument = $(document);
3030
var bodywrapper = $('.bodywrapper');
31+
var documentwrapper = $('.documentwrapper');
3132
var sidebar = $('.sphinxsidebar');
3233
var sidebarwrapper = $('.sphinxsidebarwrapper');
3334

@@ -71,7 +72,7 @@ $(function() {
7172
bodywrapper.css('margin-left', bw_margin_collapsed);
7273
sidebarbutton.css({
7374
'margin-left': '0',
74-
'height': bodywrapper.height(),
75+
'height': documentwrapper.height(),
7576
'border-radius': '5px'
7677
});
7778
sidebarbutton.find('span').text('»');
@@ -85,7 +86,7 @@ $(function() {
8586
sidebarwrapper.show();
8687
sidebarbutton.css({
8788
'margin-left': ssb_width_expanded-12,
88-
'height': Math.max(sidebarwrapper.height(), bodywrapper.height()),
89+
'height': Math.max(sidebarwrapper.height(), documentwrapper.height()),
8990
'border-radius': '0 5px 5px 0'
9091
});
9192
sidebarbutton.find('span').text('«');
@@ -109,7 +110,7 @@ $(function() {
109110
// find the height of the viewport to center the '<<' in the page
110111
var viewport_height = get_viewport_height();
111112
var sidebar_offset = sidebar.offset().top;
112-
var sidebar_height = Math.max(bodywrapper.height(), sidebar.height());
113+
var sidebar_height = Math.max(documentwrapper.height(), sidebar.height());
113114
sidebarbutton.find('span').css({
114115
'display': 'block',
115116
'position': 'fixed',

0 commit comments

Comments
 (0)