Projet

Général

Profil

Evolution #1308 » 0003-Add-intelligent-scroll-on-the-html-sidebar.patch

Guillaume AGNIERAY, 29/09/2019 22:03

Voir les différences:

source/_styles/static/galette.css
div.sphinxsidebarwrapper {
padding: 15px 0 0 0;
margin: 0;
position: relative;
}
.sphinxsidebarwrapper * {
......
color: #9AC528!important;
}
#searchbox {
display: block;
padding-bottom: 25px;
}
.searchformwrapper::after,
.searchformwrapper form::after {
display: block;
content: '';
clear: both;
}
div.admonition {
padding:1em;
width:65%;
source/_styles/static/intelligentscroll.js
/*
* All the credit for this code goes to the authors of the sphinx13 theme used
* on the sphinx-doc.org website.
*/
// intelligent scrolling of the sidebar content
$(window).scroll(function() {
var sb = $('.sphinxsidebarwrapper');
var win = $(window);
var sbh = sb.height();
var offset = $('.sphinxsidebar').offset()['top'];
var wintop = win.scrollTop();
var winbot = wintop + win.innerHeight();
var curtop = sb.offset()['top'];
var curbot = curtop + sbh;
console.log(winbot + ' ' + curbot);
// does sidebar fit in window?
if (sbh < win.innerHeight()) {
// yes: easy case -- always keep at the top
sb.css('top', $u.min([$u.max([0, wintop - offset - 10]),
$(document).height() - sbh - 200]));
} else {
// no: only scroll if top/bottom edge of sidebar is at
// top/bottom edge of window
if (curtop > wintop && curbot > winbot) {
sb.css('top', $u.max([wintop - offset - 10, 0]));
} else if (curtop < wintop && curbot < winbot) {
sb.css('top', $u.min([winbot - sbh - offset - 20,
$(document).height() - sbh - 200]));
}
}
});
source/_styles/templates/galette/layout.html
:license: see LICENSE for details.
#}
{% extends "basic/layout.html" %}
{% set script_files = script_files + ['_static/jquery.fancybox.min.js'] %}
{% set script_files = script_files + ['_static/jquery.fancybox.min.js', '_static/intelligentscroll.js'] %}
{% set css_files = css_files + ['_static/jquery.fancybox.min.css'] %}
{%- block extrahead %}
(3-3/4)