Skip to content

This is a package which makes scroll-container auto scroll to the bottom easy.

License

Notifications You must be signed in to change notification settings

Yrobot/auto-scroll

Repository files navigation

auto-scroll logo


This is a tool which makes scroll-container auto scroll to the bottom easy.

npm package


How to use

npm

yarn add @yrobot/auto-scroll
import autoScroll from "@yrobot/auto-scroll";
autoScroll({ selector: "#scroll-container-id" });

script - iife

<script src="https://cdn.jsdelivr.net/npm/@yrobot/auto-scroll/build/index.iife.js"></script>
<script>
  autoScroll.default({ selector: "#scroll-container-id" });
</script>

Why

Handle Several Situations

  • [✓] The subtree children list length increase
  • [✓] The direct child element height increase

Pack Up Useful Utilities Logic

Stop auto scroll when user scroll up

es

import autoScroll, { escapeWhenUpPlugin } from "@yrobot/auto-scroll";

autoScroll({
  selector: "#scroll-container-id",
  plugins: [escapeWhenUpPlugin()],
});

iife

autoScroll.default({
  selector: "#scroll-container-id",
  plugins: [autoScroll.escapeWhenUpPlugin()],
});