{"id":26529025,"url":"https://github.com/faustienf/scroll-into-area","last_synced_at":"2025-07-16T21:35:20.925Z","repository":{"id":65163107,"uuid":"583117473","full_name":"faustienf/scroll-into-area","owner":"faustienf","description":"♿️ Scrolls an element into view of container","archived":false,"fork":false,"pushed_at":"2023-04-29T09:07:59.000Z","size":61,"stargazers_count":9,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-07T09:37:48.855Z","etag":null,"topics":["scroll-into-view","scroll-view","scroll-viewport","smooth-scrolling"],"latest_commit_sha":null,"homepage":"https://scroll-into-area-faustienf.vercel.app","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/faustienf.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-12-28T20:23:24.000Z","updated_at":"2024-04-02T17:40:39.000Z","dependencies_parsed_at":"2025-03-21T16:33:46.580Z","dependency_job_id":null,"html_url":"https://github.com/faustienf/scroll-into-area","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/faustienf/scroll-into-area","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/faustienf%2Fscroll-into-area","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/faustienf%2Fscroll-into-area/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/faustienf%2Fscroll-into-area/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/faustienf%2Fscroll-into-area/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/faustienf","download_url":"https://codeload.github.com/faustienf/scroll-into-area/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/faustienf%2Fscroll-into-area/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265542297,"owners_count":23785205,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["scroll-into-view","scroll-view","scroll-viewport","smooth-scrolling"],"created_at":"2025-03-21T16:20:21.474Z","updated_at":"2025-07-16T21:35:20.903Z","avatar_url":"https://github.com/faustienf.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://raw.githubusercontent.com/faustienf/scroll-into-area/main/assets/cat.png\" width=\"200\"\u003e\n\u003c/p\u003e\n\n# scroll-into-area\n\n[![npm-version](https://img.shields.io/npm/v/scroll-into-area.svg)](https://npmjs.org/package/scroll-into-area)\n\n♿️ Smooth scrolling an element into view. [Demo](https://scroll-into-area.vercel.app).\n\n## Install\n\n```sh\nnpm install scroll-into-area\n```\n\n## Features\n\n- 📈 Customize [easing function](https://easings.net)\n- 🚫 Abort scrolling ([AbortSignal](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal))\n- 🔄 Waiting for animation to end\n\n## Usage\n\n```ts\nimport { scrollIntoArea } from \"scroll-into-area\";\n\nconst controller = new AbortController();\n// Abort scrolling\n// controller.abort(); ❌\n\nconst container = document.querySelector(\"ul\");\nconst target = container.querySelector(\"li\");\n\nconst progress = await scrollIntoArea(target, {\n  container,\n  x: \"end\", // start, center, end\n  y: \"start\", // start, center, end\n  duration: 400, // ms\n  signal: controller.signal,\n  // 👀 https://easings.net/#easeOutCubic\n  easing: (x) =\u003e 1 - Math.pow(1 - x, 3),\n});\n\nif (progress === 1) {\n  console.log(\"Completed\");\n} else {\n  console.log(\"Aborted\");\n}\n```\n\n### Animation\n\nLinear function `(t) =\u003e t` is used by default. Pass [easing](https://easings.net), if you want to change easing function.\n`duration` is animation duration in milliseconds.\n\n```ts\nscrollIntoArea(target, {\n  duration: 400, // ms\n  // 👀 https://easings.net/#easeOutCubic\n  easing: (x) =\u003e 1 - Math.pow(1 - x, 3),\n});\n```\n\n### Abort scrolling\n\nPass `signal` ([AbortSignal](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal)),\nif you want to abort scrolling.\n\n```ts\nconst controller = new AbortController();\nsetTimeout(() =\u003e {\n  controller.abort();\n}, 100);\n\nconst progress = await scrollIntoArea(target, {\n  ...,\n  signal: controller.signal,\n});\n\nif (progress !== 1) {\n  console.log('Scrolling has been aborted.');\n}\n```\n\n`progress` is a number from _0_ to _1_.\n\n`1` - Scrolling is completed _100%_.\n\n`\u003c1` - Scrolling has been aborted and completed _x%_.\n\n```ts\nconst progress = await scrollIntoArea(target, {\n  ...,\n});\n\nif (progress !== 1) {\n  console.log('Scrolling has been aborted.');\n} else {\n  console.log('Completed.');\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffaustienf%2Fscroll-into-area","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffaustienf%2Fscroll-into-area","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffaustienf%2Fscroll-into-area/lists"}