mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-07-06 04:37:51 +02:00
fix: error when trackHeight is 0
This commit is contained in:
@@ -98,9 +98,8 @@ function enableHandle() {
|
||||
function getIndexFromTrack() {
|
||||
const { top: handleTop } = handleEl.getBoundingClientRect();
|
||||
const delta = handleTop - trackTop;
|
||||
const percentage = delta / trackHeight;
|
||||
const percentage = trackHeight > 0 ? delta / trackHeight : 0;
|
||||
const index = Math.floor(ajaxify.data.postcount * percentage);
|
||||
|
||||
return index;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user