{"id":17066820,"url":"https://github.com/tobyzerner/sticky-observer","last_synced_at":"2026-04-13T22:33:19.737Z","repository":{"id":57370903,"uuid":"453813315","full_name":"tobyzerner/sticky-observer","owner":"tobyzerner","description":"Observe when sticky elements become stuck and unstuck.","archived":false,"fork":false,"pushed_at":"2024-01-17T00:24:06.000Z","size":152,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-23T11:27:25.362Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"HTML","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/tobyzerner.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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-01-30T22:02:36.000Z","updated_at":"2025-07-04T00:07:31.000Z","dependencies_parsed_at":"2024-01-17T02:33:54.385Z","dependency_job_id":"3f8cd21b-3414-4904-9f31-1d9fe214ba3d","html_url":"https://github.com/tobyzerner/sticky-observer","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/tobyzerner/sticky-observer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tobyzerner%2Fsticky-observer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tobyzerner%2Fsticky-observer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tobyzerner%2Fsticky-observer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tobyzerner%2Fsticky-observer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tobyzerner","download_url":"https://codeload.github.com/tobyzerner/sticky-observer/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tobyzerner%2Fsticky-observer/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31774028,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-13T20:17:16.280Z","status":"ssl_error","status_checked_at":"2026-04-13T20:17:08.216Z","response_time":93,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":[],"created_at":"2024-10-14T11:08:27.477Z","updated_at":"2026-04-13T22:33:19.707Z","avatar_url":"https://github.com/tobyzerner.png","language":"HTML","readme":"# Sticky Observer\n\n**Observe when `position: sticky` elements become stuck and unstuck.**\n\nSets up an `IntersectionObserver` for the sticky element, using negative `rootMargin` values so that when the element reaches its sticky position, the observer will see the bounding box as being slightly off-screen.\n\n![npm bundle size](https://img.shields.io/bundlephobia/minzip/sticky-observer)\n\n## Installation\n\n```\nnpm install sticky-observer --save\n```\n\n## Usage\n\n```ts\nimport StickyObserver from 'sticky-observer';\n\n// Construct the observer by passing the element to watch, and a\n// callback to be run whenever the element becomes stuck or unstuck.\nconst observer = new StickyObserver(el, (stuck) =\u003e {\n    el.classList.toggle('is-stuck', stuck);\n});\n```\n\n### Options\n\nYou can pass options as the third argument:\n\n```ts\nconst observer = new StickyObserver(el, callback, {\n    // The element that is used as the viewport for checking the state of the\n    // element. Defaults to the browser viewport if not specified.\n    root: document,\n});\n```\n\n### Methods\n\n```ts\n// Start observing the element. This is called automatically when the observer is\n// constructed, so there's no need to call it again, unless you've stopped the\n// observer previously. You can also call it to recalibrate the observer if you\n// know that the element's sticky offset has changed.\nobserver.start();\n\n// Stop observing the element.\nobserver.stop();\n```\n\n## Contributing\n\nPull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.\n\n## License\n\n[MIT](LICENSE)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftobyzerner%2Fsticky-observer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftobyzerner%2Fsticky-observer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftobyzerner%2Fsticky-observer/lists"}