{"id":13475675,"url":"https://github.com/zachleat/carouscroll","last_synced_at":"2025-07-17T02:14:37.489Z","repository":{"id":220146647,"uuid":"750879593","full_name":"zachleat/carouscroll","owner":"zachleat","description":"Add next/previous buttons to a horizontal scrollable container.","archived":false,"fork":false,"pushed_at":"2024-02-07T21:21:29.000Z","size":51,"stargazers_count":124,"open_issues_count":4,"forks_count":6,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-03-28T22:42:50.713Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://zachleat.github.io/carouscroll/demo.html","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/zachleat.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":"2024-01-31T14:03:16.000Z","updated_at":"2025-01-24T19:01:52.000Z","dependencies_parsed_at":"2024-01-31T15:50:22.759Z","dependency_job_id":"0cd19331-be2a-4bd7-8a3b-eceec5e86d11","html_url":"https://github.com/zachleat/carouscroll","commit_stats":null,"previous_names":["zachleat/carouscroll"],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zachleat%2Fcarouscroll","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zachleat%2Fcarouscroll/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zachleat%2Fcarouscroll/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zachleat%2Fcarouscroll/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zachleat","download_url":"https://codeload.github.com/zachleat/carouscroll/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249116248,"owners_count":21215143,"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":[],"created_at":"2024-07-31T16:01:22.448Z","updated_at":"2025-04-15T17:10:34.163Z","avatar_url":"https://github.com/zachleat.png","language":"HTML","funding_links":[],"categories":["HTML"],"sub_categories":[],"readme":"# carouscroll\n\nA web component to add next/previous buttons to a horizontal scrollable container.\n\n* [Demos](https://zachleat.github.io/carouscroll/demo.html)\n\n## Features\n\n* Interaction compatible with scroll or touch.\n* No layout shift. Make sure you include the CSS snippet!\n* (Optional) Smooth scrolling with `scroll-behavior: smooth`.\n* (Optional) `loop` attribute to enable looping around from start/end.\n* (Optional) Next/Previous buttons can be placed anywhere in the document.\n* (Optional) `\u003coutput\u003e` element can accessibly announce the current slide number (out of total number of slides).\n\n## Installation\n\nYou can install via `npm` ([`@zachleat/carouscroll`](https://www.npmjs.com/package/@zachleat/carouscroll)) or download the `carouscroll.js` JavaScript file manually.\n\n```shell\nnpm install @zachleat/carouscroll --save\n```\n\nAdd `carouscroll.js` to your site’s JavaScript assets.\n\n## Usage\n\nFirst you need to add some critical CSS to your page. These styles are **crucial** to reduce Layout Shift (CLS), set the aspect ratio of the slides, and to avoid loading `loading=\"lazy\"` images on off-screen slides.\n\n```css\ncarou-scroll {\n\tdisplay: flex;\n\toverflow-x: scroll;\n\toverflow-y: hidden;\n}\ncarou-scroll \u003e * {\n\tmin-width: 100%;\n\taspect-ratio: 16/9;\n}\n```\n\nNext, add the HTML:\n\n```html\n\u003ccarou-scroll id=\"my-scroller\"\u003e\n\t\u003cdiv class=\"demo-slide\"\u003e1\u003c/div\u003e\n\t\u003cdiv class=\"demo-slide\"\u003e2\u003c/div\u003e\n\t\u003c!-- … --\u003e\n\u003c/carou-scroll\u003e\n```\n\nThat’s it!\n\n### Add buttons (optional)\n\nFor maximum flexibility, these buttons can be placed anywhere in the document and are tied by an `id` back to the parent scroller.\n\nMake sure you think about the before/after JavaScript experience here. This component will remove `disabled` for you but you can add additional styling via your own CSS: `carou-scroll:defined {}`.\n\n```html\n\u003cbutton type=\"button\" disabled data-carousel-previous=\"my-scroller\"\u003ePrevious\u003c/button\u003e\n\u003cbutton type=\"button\" disabled data-carousel-next=\"my-scroller\"\u003eNext\u003c/button\u003e\n```\n\n### Add output (optional)\n\nThis will update (and accessibly announce) a current status element with e.g. `Slide 1 of 10` text.\n\nFor maximum flexibility, this element can be placed anywhere in the document and is tied by an `id` back to the parent scroller.\n\n```html\n\u003coutput data-carousel-output=\"my-scroller\"\u003e\u003c/output\u003e\n```\n\n### Make it loop around (optional)\n\nAdd the `loop` attribute.\n\n```html\n\u003ccarou-scroll id=\"my-scroller\" loop\u003e\n```\n\n### Smooth scrolling CSS (optional)\n\n```css\ncarou-scroll {\n\tscroll-behavior: smooth;\n}\n```\n\n### Add your own scroll snap CSS (optional)\n\n```css\ncarou-scroll {\n\tscroll-snap-type: x mandatory;\n}\ncarou-scroll \u003e * {\n\tscroll-snap-align: center;\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzachleat%2Fcarouscroll","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzachleat%2Fcarouscroll","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzachleat%2Fcarouscroll/lists"}