Commit 8ab24b2e authored by Julien Palard's avatar Julien Palard Committed by Stéphane Wirtel

[2.7] bpo-24712: Doc: Make sidebar sticky using browser support. (GH-13179)

Patch by Mike Taylor.
parent 7c2c01f0
......@@ -46,6 +46,15 @@ $(function() {
var dark_color = $('.related').css('background-color');
var light_color = $('.document').css('background-color');
// set position: sticky on sidebar
// (browsers that don't support this will fall-back to
// positioning via scroll_sidebar)
var supportsPositionSticky = (window.CSS && window.CSS.supports &&
window.CSS.supports('position', 'sticky'));
if (supportsPositionSticky) {
sidebarwrapper.css('position', 'sticky');
}
function get_viewport_height() {
if (window.innerHeight)
return window.innerHeight;
......@@ -157,6 +166,9 @@ $(function() {
/* intelligent scrolling */
function scroll_sidebar() {
if (supportsPositionSticky) {
return;
}
var sidebar_height = sidebarwrapper.height();
var viewport_height = get_viewport_height();
var offset = sidebar.position()['top'];
......
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