Fixes to scrolling algorithm for IE11

Former-commit-id: ed325c04c22db645bc20de67bed2be97588eb3a7 [formerly be8db5350a7a0c980554e2c6e89bbf4d8c6ecc98]
Former-commit-id: fa393251bde6e9b6726101e0cc82c11d121cc154
This commit is contained in:
Jaifroid 2020-01-19 10:15:17 +00:00
parent 87f28083b2
commit 5eb89721ff
3 changed files with 7 additions and 6 deletions

View File

@ -256,7 +256,7 @@
</nav> </nav>
</header> </header>
<article class="view-content" id="article"> <article class="view-content" id="article">
<div id="scrollbox" class="container" style="position:relative;z-index:-2;overflow:auto;width:100%;"> <div id="scrollbox" class="container" style="position:relative;overflow:auto;width:100%;">
<div id="about" style="display: none;" class="category-padding"> <div id="about" style="display: none;" class="category-padding">
<div class="returntoArticle" style="text-align:center;padding-top:30px;"></div> <div class="returntoArticle" style="text-align:center;padding-top:30px;"></div>
<h2> <h2>

View File

@ -937,13 +937,13 @@ define(['jquery', 'zimArchiveLoader', 'uiUtil', 'util', 'utf8', 'images', 'cooki
var scrollFunction = function () { var scrollFunction = function () {
damper--; damper--;
newScrollY = iframe.contentWindow.scrollY; if (damper > 0) return;
newScrollY = iframe.contentWindow.pageYOffset;
var prefix = document.getElementById('prefix'); var prefix = document.getElementById('prefix');
var findInArticle = document.getElementById('findInArticle'); var findInArticle = document.getElementById('findInArticle');
// Hide the toolbars if user has scrolled and search elements are not selected // Hide the toolbars if user has scrolled and search elements are not selected
if (newScrollY - oldScrollY > 0 && document.activeElement !== prefix if (newScrollY - oldScrollY > 0 && document.activeElement !== prefix
&& document.activeElement !== findInArticle) { && document.activeElement !== findInArticle) {
if (damper > 0) return;
// If the header and/or footer have not already been hidden // If the header and/or footer have not already been hidden
if (/\(0p?x?\)/.test(header.style.transform)) { if (/\(0p?x?\)/.test(header.style.transform)) {
setTimeout(function() { setTimeout(function() {
@ -965,16 +965,17 @@ define(['jquery', 'zimArchiveLoader', 'uiUtil', 'util', 'utf8', 'images', 'cooki
} }
}, 200); }, 200);
} }
} else { } else if (newScrollY - oldScrollY < 0) {
header.style.zIndex = 1; header.style.zIndex = 1;
header.style.transform = 'translateY(0)'; header.style.transform = 'translateY(0)';
footer.style.transform = 'translateY(0)'; footer.style.transform = 'translateY(0)';
} }
oldScrollY = newScrollY; oldScrollY = newScrollY;
damper = 10;
}; };
function checkToolbar() { function checkToolbar() {
oldScrollY = iframe.contentWindow.scrollY; oldScrollY = iframe.contentWindow.pageYOffset;
navbarDim = document.getElementById('navbar').getBoundingClientRect(); navbarDim = document.getElementById('navbar').getBoundingClientRect();
footerDim = footer.getBoundingClientRect(); footerDim = footer.getBoundingClientRect();
header.style.transition = "transform 500ms"; header.style.transition = "transform 500ms";

View File

@ -31,7 +31,7 @@ window.onerror = function (msg, url) {
var state = {}; var state = {};
// Parameters that define overall operation of app // Parameters that define overall operation of app
var params = {}; var params = {};
params['version'] = "0.9.9.96 Beta"; //DEV: This value is compared to the cookie "version" in order to show first-time info, and the cookie is updated in app.js params['version'] = "0.9.9.97-WIP Beta"; //DEV: This value is compared to the cookie "version" in order to show first-time info, and the cookie is updated in app.js
params['packagedFile'] = "wikipedia_en_ray_charles.zim"; //For packaged Kiwix JS (e.g. with Wikivoyage file), set this to the filename (for split files, give the first chunk *.zimaa) and place file(s) in default storage params['packagedFile'] = "wikipedia_en_ray_charles.zim"; //For packaged Kiwix JS (e.g. with Wikivoyage file), set this to the filename (for split files, give the first chunk *.zimaa) and place file(s) in default storage
params['archivePath'] = "archive"; //The directory containing the packaged archive(s) (relative to app's root directory) params['archivePath'] = "archive"; //The directory containing the packaged archive(s) (relative to app's root directory)
params['fileVersion'] = "wikipedia_en_ray_charles_maxi_2019-08.zim (14-Aug-2019)"; //Use generic name for actual file, and give version here params['fileVersion'] = "wikipedia_en_ray_charles_maxi_2019-08.zim (14-Aug-2019)"; //Use generic name for actual file, and give version here