FIX: Without suggested topics jumping to a post had the wrong offset

This commit is contained in:
Robin Ward 2017-04-24 13:21:50 -04:00
parent df77a827e1
commit 4e1f8ec72b

View File

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