{"id":16910573,"url":"https://github.com/estrattonbailey/overunder","last_synced_at":"2025-03-22T10:31:49.813Z","repository":{"id":57317075,"uuid":"62493915","full_name":"estrattonbailey/overunder","owner":"estrattonbailey","description":"Tiny waypoint library.","archived":false,"fork":false,"pushed_at":"2018-11-01T20:32:23.000Z","size":111,"stargazers_count":25,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-15T23:15:44.858Z","etag":null,"topics":["emits-events","listeners","position","waypoint-library"],"latest_commit_sha":null,"homepage":"https://overunder.now.sh/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/estrattonbailey.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-07-03T11:39:05.000Z","updated_at":"2023-12-09T11:12:33.000Z","dependencies_parsed_at":"2022-08-25T20:40:40.813Z","dependency_job_id":null,"html_url":"https://github.com/estrattonbailey/overunder","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/estrattonbailey%2Foverunder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/estrattonbailey%2Foverunder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/estrattonbailey%2Foverunder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/estrattonbailey%2Foverunder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/estrattonbailey","download_url":"https://codeload.github.com/estrattonbailey/overunder/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244943931,"owners_count":20536290,"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":["emits-events","listeners","position","waypoint-library"],"created_at":"2024-10-13T19:01:48.372Z","updated_at":"2025-03-22T10:31:49.473Z","avatar_url":"https://github.com/estrattonbailey.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# overunder\nTiny waypoint library. **750 bytes gzipped.**\n\n## Features\n1. Supports both x and y axis\n2. Accepts both integer values and DOM nodes\n3. Only one `scroll` and one `resize` listener\n\n# Usage\n```javascript\nimport overunder from 'overunder'\n\nconst scroller = overunder({\n  y: 1000\n})\n\nscroller.on('y over', () =\u003e {\n  console.log('user scrolled over 1000px')\n})\n\nscroller.update()\n```\n```javascript\nimport overunder from 'overunder'\n\nconst scroller = overunder({\n  y: document.getElementById('lazyImg')\n})\n\nscroller.on('y over', () =\u003e {\n  console.log('#lazyImg is visible')\n})\n\nscroller.update()\n```\n```javascript\nimport overunder from 'overunder'\n\nconst scroller = overunder({\n  x: 900\n})\n\nscroller.on('x under', () =\u003e {\n  console.log('viewport is \u003c 900px wide')\n})\n\nscroller.update()\n```\n```javascript\nimport overunder from 'overunder'\n\nconst scroller = overunder({\n  x: 900,\n  x2: 1200\n})\n\nscroller.on('x between', () =\u003e {\n  console.log('viewport is between 900px and 1200px wide')\n})\n\nscroller.update()\n```\n```javascript\nimport overunder from 'overunder'\n\nconst scroller = overunder({\n  x: 900,\n  y: document.getElementById('hideNavTrigger')\n})\n\nscroller.on('x under', () =\u003e {\n  scroller.update({\n    y: document.getElementById('hideNavTrigger2')\n  })\n})\nscroller.on('x over', () =\u003e {\n  scroller.update({\n    y: document.getElementById('hideNavTrigger')\n  })\n})\n\nscroller.update()\n```\n\n## Events\n`overunder` emits events depending on what waypoints you pass to it. They follow\nthe same pattern: `\u003caxis\u003e \u003cposition\u003e`. Given an `x` and `y` value, `overunder`\nwill emit the following events.\n- `x over`\n- `x under`\n- `y over`\n- `y under`\n\nPass a second value for each and `overunder` will emit `between` event:\n- `x between`\n- `y between`\n\n### Subscribing to events\n```javascript\nconst listener = scroll.on('y over', () =\u003e {})\n\nlistener() // destroy listener\n```\n\n## API\n### update([options])\nChecks position and fires applicable listeners.\n```javascript\nscroller.update()\n```\nPass an optional options object to update waypoint values.\n```javascript\nscroller.update({\n  x: 1000\n})\n```\n\n## License\nMIT License © [Eric Bailey](https://estrattonbailey.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Festrattonbailey%2Foverunder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Festrattonbailey%2Foverunder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Festrattonbailey%2Foverunder/lists"}