Fix Firefox mobile unneeded resize

Before that, on Firefox Mobile, when you were moving to the top or to
the bottom of the page, you were stopped before to go to the opposite
side.
This commit is contained in:
Simounet 2018-05-24 08:27:15 +02:00
parent 1d770f9867
commit f136d288d6
4 changed files with 7 additions and 5 deletions

View file

@ -65,7 +65,7 @@ $(document).ready(() => {
retrievePercent(x.entryId); retrievePercent(x.entryId);
$(window).resize(() => { $(window).resize(() => {
retrievePercent(x.entryId); retrievePercent(x.entryId, true);
}); });
} }
}); });

View file

@ -19,14 +19,16 @@ function savePercent(id, percent) {
return true; return true;
} }
function retrievePercent(id) { function retrievePercent(id, resized) {
if (!supportsLocalStorage()) { return false; } if (!supportsLocalStorage()) { return false; }
const bheight = $(document).height(); const bheight = $(document).height();
const percent = localStorage[`wallabag.article.${id}.percent`]; const percent = localStorage[`wallabag.article.${id}.percent`];
const scroll = bheight * percent; const scroll = bheight * percent;
if (!resized) {
$('html,body').animate({ scrollTop: scroll }, 'fast'); $('html,body').animate({ scrollTop: scroll }, 'fast');
}
return true; return true;
} }

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long