mirror of
https://github.com/discourse/discourse.git
synced 2024-12-18 12:18:44 +08:00
FIX: Without suggested topics jumping to a post had the wrong offset
This commit is contained in:
parent
df77a827e1
commit
4e1f8ec72b
|
@ -33,12 +33,11 @@ export default function offsetCalculator(y) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (inter > ideal) {
|
if (inter > ideal) {
|
||||||
const bottom = $('#topic-bottom').offset().top;
|
const bottom = $('#topic-bottom').offset().top;
|
||||||
const switchPos = bottom - rawWinHeight;
|
const switchPos = bottom - rawWinHeight;
|
||||||
if (scrollTop > switchPos) {
|
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);
|
return ((1 - p) * ideal) + (p * inter);
|
||||||
} else {
|
} else {
|
||||||
return ideal;
|
return ideal;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user