A lightweight tool to auto-scroll content on your website.
Perfect for AI chat pages - automatically scrolls to bottom when new messages arrive.
npm install @yrobot/auto-scrollUsage:
import autoScroll from "@yrobot/auto-scroll";
autoScroll({
selector: "#scroll-container-id",
// OR: pass the container element directly
// container: document.getElementById("scroll-container-id")
});For usage without a build system:
<script src="https://cdn.jsdelivr.net/npm/@yrobot/auto-scroll/build/index.iife.js"></script>
<script>
autoScroll.default({
selector: "#scroll-container-id",
// OR: pass the container element directly
// container: document.getElementById("scroll-container-id")
});
</script>- ✅ Dynamic content additions - Automatically scrolls when child elements are added to the container
- ✅ Growing content - Automatically scrolls when child element height increases (e.g., streaming text in chat interfaces)
🎁 Pre-built plugins are ready to use out of the box - no configuration needed!
What it does: Pauses auto-scrolling when the user manually scrolls up to read previous content.
Perfect for: Chat interfaces where users may want to review conversation history without constant interruption.
import autoScroll, { escapeWhenUpPlugin } from "@yrobot/auto-scroll";
autoScroll({
selector: "#scroll-container-id",
plugins: [escapeWhenUpPlugin()],
});<script>
autoScroll.default({
selector: "#scroll-container-id",
plugins: [autoScroll.escapeWhenUpPlugin()],
});
</script>See CHANGELOG.md for release history.
