diff options
| author | 2018-12-16 12:49:23 +0100 | |
|---|---|---|
| committer | 2018-12-16 12:49:23 +0100 | |
| commit | 483c698f9a75636e472737872dcc33a4906b9ed9 (patch) | |
| tree | 887ae252f2cb6aa1e12278de939515580a691c4c /p/scripts | |
| parent | 983aa587ee71a83d21b17de29d2a26763b18292e (diff) | |
JavaScript-free scrollbar (#2181)
* JavaScript-free scrollbar
Make scrollbar work without JavaScript
https://github.com/FreshRSS/FreshRSS/pull/2117#discussion_r240804225
Also implies a better support of resize scenarios.
Seems to fix at the same time the occasional glitches
https://github.com/FreshRSS/FreshRSS/pull/2117#issuecomment-447556038
* Firefox 64-66 workaround
Workaround for Gecko bug in Firefox 64-66. Avoid showing the scrollbar
all the time, at the cost of a slight reflow (therefore targetting only
Gecko).
* Improvement of Firefox workaround
* Minor comment
* Unneeded check
* Even better
* Partial Edge fix
* More margin for tree bottom
Diffstat (limited to 'p/scripts')
| -rw-r--r-- | p/scripts/main.js | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/p/scripts/main.js b/p/scripts/main.js index 6331efc75..c8d520ef7 100644 --- a/p/scripts/main.js +++ b/p/scripts/main.js @@ -551,7 +551,13 @@ function init_column_categories() { } }); $(this).parent().next(".tree-folder-items").slideToggle(300, function () { - if (useJsScrollbar && sidebar && typeof(Event) === 'function') { //Refresh JS scrollbar + if (!useJsScrollbar && //Workaround for Gecko bug in Firefox 64-65(+?): + sidebar.scrollHeight > sidebar.clientHeight && //if needs scrollbar + sidebar.scrollWidth >= sidebar.offsetWidth) { //but no scrollbar + sidebar.style['overflow-y'] = 'scroll'; //then force scrollbar + setTimeout(function () { sidebar.style['overflow-y'] = ''; }, 0); + } + if (useJsScrollbar && typeof(Event) === 'function') { //Refresh JS scrollbar sidebar.querySelector('.ss-content').dispatchEvent(new Event('scroll')); } }); @@ -1279,7 +1285,7 @@ var useJsScrollbar = true; try { /*jshint -W018 */ useJsScrollbar = sidebar && !CSS.supports('scrollbar-color: auto') && - !(parseInt(getComputedStyle(sidebar, '::-webkit-scrollbar').width) < sidebar.offsetWidth); + !(parseInt(getComputedStyle(sidebar, '::-webkit-scrollbar').width) < sidebar.scrollWidth); /*jshint +W018 */ } catch (ex) { } @@ -1312,12 +1318,10 @@ function init_simple_scrollbar() { var scrollTimeout; function init_sticky_sidebar(){ - if (!sidebar) { + if (!useJsScrollbar) { return; } - if (useJsScrollbar) { - init_simple_scrollbar(); - } + init_simple_scrollbar(); $(window).scroll(function () { if (scrollTimeout) { clearTimeout(scrollTimeout); |
