FIX: Scrolling to the bottom was still a bit weird with no suggested

This commit is contained in:
Robin Ward 2017-04-24 16:36:20 -04:00
parent 29ddb3a611
commit f41ab98e86

View File

@ -36,8 +36,12 @@ export default function offsetCalculator(y) {
if (inter > ideal) {
const bottom = $('#topic-bottom').offset().top;
const switchPos = bottom - rawWinHeight;
if (scrollPercent >= 1.0) {
return 0;
}
if (scrollTop > switchPos) {
const p = Math.max(Math.min((scrollTop + inter - switchPos) / bottom, 1.0), 0.0);
const p = Math.max(Math.min((scrollTop + inter - switchPos) / rawWinHeight, 1.0), 0.0);
return ((1 - p) * ideal) + (p * inter);
} else {
return ideal;