So I'm writing some javascript¹ for a textbox that automatically scrolls when new content is added but only if you're already scrolled to the bottom, and I'm actually more than a little confused about how to detect I'm already at the bottom. What would be a lot easier, the way I'm doing this, is to detect that the bottom item is visible on screen, and to force a rescroll when a change occurs while bottom item is visible. So scrolling ALMOST to the bottom would "lock"

¹ okay, Rust. It's cursed

Replying to @nabijaczleweli@101010.pl

@nabijaczleweli do you think that would be better than this? mastodon.social/@mcc/116869331

mcc@mcc@mastodon.social

@eramdam how good an approach do you think this is? it seems "perfect" but i'm not sure if it's compatible with what i'm doing now (because what i'm doing now is modifying a scroller that blanks divs that are too far offscreen) css-tricks.com/books/greatest-

Replying to @eramdam@erambert.me

@eramdam how good an approach do you think this is? it seems "perfect" but i'm not sure if it's compatible with what i'm doing now (because what i'm doing now is modifying a scroller that blanks divs that are too far offscreen) css-tricks.com/books/greatest-

Pin Scrolling to BottomCSS-TricksPin Scrolling to Bottom - CSS-TricksIn perhaps in the top 5 most annoying things a website can do is this. You're trying to read something (or click something!) and all the sudden the page shift underneath you (or you mis-click!). There is a CSS property that can help fix that. Plus, we can exploit it to do something that was previously exclusively in the realm of JavaScript.