From f0e83f4d9fdbf0c7df2a48b38a7142bd8165851b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dami=C3=A1n=20Herrera?= Date: Sun, 12 May 2024 18:11:34 -0300 Subject: [PATCH] Update jquery.slimscroll.js When working with large scrolls, the accuracy of the calculation is essential. It has happened to me with scrolls of 90 A4 sheets (~116800px) that the Jump did not take into account the height of the Bar. This makes the first scroll with the wheel behave very strange. With the modification made this behavior is corrected. --- jquery.slimscroll.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jquery.slimscroll.js b/jquery.slimscroll.js index 1c6a53b..7006a5e 100644 --- a/jquery.slimscroll.js +++ b/jquery.slimscroll.js @@ -368,7 +368,7 @@ if (isJump) { delta = y; - var offsetTop = delta / me[0].scrollHeight * me.outerHeight(); + var offsetTop = (delta / me[0].scrollHeight) * (me.outerHeight() - bar.height()); offsetTop = Math.min(Math.max(offsetTop, 0), maxTop); bar.css({ top: offsetTop + 'px' }); }