Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions Doc/tools/static/sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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'];
Expand Down