We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 682f181 + fe1b729 commit e74cb09Copy full SHA for e74cb09
1 file changed
public/js/script.js
@@ -371,6 +371,18 @@ function updateCaretPosition() {
371
left: newLeft
372
}, duration)
373
374
+ let browserHeight = window.innerHeight;
375
+ let middlePos = (browserHeight / 2) - $("#caret").outerHeight()/2;
376
+ let contentHeight = document.body.scrollHeight;
377
+
378
+ if (newTop >= middlePos && contentHeight > browserHeight) {
379
+ window.scrollTo({
380
+ left: 0,
381
+ top: newTop - middlePos,
382
+ behavior: 'smooth'
383
+ })
384
+ }
385
386
}
387
388
function countChars() {
0 commit comments