Skip to content

Commit 67eedfa

Browse files
committed
Fix sidebar height issue
1 parent 245418d commit 67eedfa

File tree

1 file changed

+2
-20
lines changed

1 file changed

+2
-20
lines changed

python_docs_theme/static/sidebar.js

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,7 @@ $(function() {
2525
// global elements used by the functions.
2626
// the 'sidebarbutton' element is defined as global after its
2727
// creation, in the add_sidebar_button function
28-
var jwindow = $(window);
2928
var bodywrapper = $('.bodywrapper');
30-
var documentwrapper = $('.documentwrapper');
3129
var sidebar = $('.sphinxsidebar');
3230
var sidebarwrapper = $('.sphinxsidebarwrapper');
3331

@@ -45,13 +43,6 @@ $(function() {
4543
var dark_color = '#AAAAAA';
4644
var light_color = '#CCCCCC';
4745

48-
function get_viewport_height() {
49-
if (window.innerHeight)
50-
return window.innerHeight;
51-
else
52-
return jwindow.height();
53-
}
54-
5546
function sidebar_is_collapsed() {
5647
return sidebarwrapper.is(':not(:visible)');
5748
}
@@ -69,7 +60,6 @@ $(function() {
6960
bodywrapper.css('margin-left', bw_margin_collapsed);
7061
sidebarbutton.css({
7162
'margin-left': '0',
72-
'height': documentwrapper.height(),
7363
'border-radius': '5px'
7464
});
7565
sidebarbutton.find('span').text('»');
@@ -83,13 +73,10 @@ $(function() {
8373
sidebarwrapper.show();
8474
sidebarbutton.css({
8575
'margin-left': ssb_width_expanded-12,
86-
'height': Math.max(sidebarwrapper.height(), documentwrapper.height()),
8776
'border-radius': '0 5px 5px 0'
8877
});
8978
sidebarbutton.find('span').text('«');
9079
sidebarbutton.attr('title', _('Collapse sidebar'));
91-
//sidebarwrapper.css({'padding-top':
92-
// Math.max(window.pageYOffset - sidebarwrapper.offset().top, 10)});
9380
document.cookie = 'sidebar=expanded';
9481
}
9582

@@ -104,14 +91,10 @@ $(function() {
10491
'<div id="sidebarbutton"><span>&laquo;</span></div>'
10592
);
10693
var sidebarbutton = $('#sidebarbutton');
107-
// find the height of the viewport to center the '<<' in the page
108-
var viewport_height = get_viewport_height();
109-
var sidebar_offset = sidebar.offset().top;
110-
var sidebar_height = Math.max(documentwrapper.height(), sidebar.height());
11194
sidebarbutton.find('span').css({
11295
'display': 'block',
11396
'position': 'fixed',
114-
'top': Math.min(viewport_height/2, sidebar_height/2 + sidebar_offset) - 10
97+
'top': '50%'
11598
});
11699

117100
sidebarbutton.click(toggle_sidebar);
@@ -122,8 +105,7 @@ $(function() {
122105
'background-color': '#CCCCCC',
123106
'font-size': '1.2em',
124107
'cursor': 'pointer',
125-
'height': sidebar_height,
126-
'padding-top': '1px',
108+
'height': '100%',
127109
'padding-left': '1px',
128110
'margin-left': ssb_width_expanded - 12
129111
});

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy