{"id":13825249,"url":"https://github.com/NigelOToole/priority-nav-scroller","last_synced_at":"2025-07-08T21:31:45.717Z","repository":{"id":32531093,"uuid":"133965837","full_name":"NigelOToole/priority-nav-scroller","owner":"NigelOToole","description":"Javascript plugin for the priority+ navigation pattern.","archived":false,"fork":false,"pushed_at":"2023-03-01T18:26:23.000Z","size":1688,"stargazers_count":210,"open_issues_count":8,"forks_count":12,"subscribers_count":9,"default_branch":"master","last_synced_at":"2024-11-06T16:26:15.475Z","etag":null,"topics":["navigation","priority-nav-scroller","priority-navigation","scroller","scrolling","vanilla-javascript","vanilla-js"],"latest_commit_sha":null,"homepage":"http://nigelotoole.github.io/priority-nav-scroller/","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/NigelOToole.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}},"created_at":"2018-05-18T14:33:30.000Z","updated_at":"2024-06-04T13:24:40.000Z","dependencies_parsed_at":"2024-01-18T03:49:09.587Z","dependency_job_id":null,"html_url":"https://github.com/NigelOToole/priority-nav-scroller","commit_stats":{"total_commits":36,"total_committers":2,"mean_commits":18.0,"dds":"0.33333333333333337","last_synced_commit":"a786d344d2f23e7ed5228a382fa2ae72c61d4820"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NigelOToole%2Fpriority-nav-scroller","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NigelOToole%2Fpriority-nav-scroller/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NigelOToole%2Fpriority-nav-scroller/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NigelOToole%2Fpriority-nav-scroller/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NigelOToole","download_url":"https://codeload.github.com/NigelOToole/priority-nav-scroller/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225465291,"owners_count":17478518,"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":["navigation","priority-nav-scroller","priority-navigation","scroller","scrolling","vanilla-javascript","vanilla-js"],"created_at":"2024-08-04T09:01:17.213Z","updated_at":"2024-11-20T03:30:54.959Z","avatar_url":"https://github.com/NigelOToole.png","language":"HTML","funding_links":[],"categories":["HTML"],"sub_categories":[],"readme":"# Priority Nav Scroller\n\n### Priority Nav Scroller is a plugin for the priority+ navigation pattern. When navigation items don’t fit on screen they are hidden and can be scrolled into view or using controls.\n\n### [View demo](http://nigelotoole.github.io/priority-nav-scroller/)\n\n\n\n## Installation\n```javascript\n$ npm install priority-nav-scroller --save-dev\n```\n\n\n## Usage\n\n### Import JS\n\nThe script is an ES6(ES2015) module but the compiled version is included in the build as \"src/scripts/priority-nav-scroller-umd.js\". You can also copy \"src/scripts/priority-nav-scroller.js\" into your own site if your build process can accommodate ES6 modules.\n\n```javascript\nimport PriorityNavScroller from './priority-nav-scroller.js';\n\n// Init with default setup\nconst priorityNavScrollerDefault = PriorityNavScroller();\n\n// Init with all options at default setting\nconst priorityNavScrollerDefault = PriorityNavScroller({\n  selector: '.nav-scroller',\n  navSelector: '.nav-scroller-nav',\n  contentSelector: '.nav-scroller-content',\n  itemSelector: '.nav-scroller-item',\n  buttonLeftSelector: '.nav-scroller-btn--left',\n  buttonRightSelector: '.nav-scroller-btn--right',\n  scrollStep: 80\n});\n\n// Init multiple nav scrollers with the same options\nlet navScrollers = document.querySelectorAll('.nav-scroller');\n\nnavScrollers.forEach((currentValue, currentIndex) =\u003e {\n  PriorityNavScroller({\n    selector: currentValue\n  });\n});\n```\n\n\n### Options\n| Property              | Default                    | Type          | Description                                                              |\n| --------------------- | -------------------------- | ------------- | ------------------------------------------------------------------------ |\n| `selector`            | '.nav-scroller'            | String/Node   | Container element selector.                                              |\n| `navSelector`         | '.nav-scroller-nav'        | String        | Item element selector.                                                   |\n| `contentSelector`     | '.nav-scroller-content'    | String        | Content element selector.                                                |\n| `itemSelector`        | '.nav-scroller-item'       | String        | Item element selector.                                                   |\n| `buttonLeftSelector`  | '.nav-scroller-btn--left'  | String        | Left button element selector.                                            |\n| `buttonRightSelector` | '.nav-scroller-btn--right' | String        | Right button element selector.                                           |\n| `scrollStep`          | 80                         | Number/String | Amount to scroll on button click. 'average' gets the average link width. |\n\n\n### Import SASS\n\n```scss\n@import \"node_modules/priority-nav-scroller/src/styles/priority-nav-scroller.scss\";\n```\n\n\n### Markup\n\n```html\n\u003cdiv class=\"nav-scroller\"\u003e\n\n  \u003cnav class=\"nav-scroller-nav\"\u003e\n    \u003cdiv class=\"nav-scroller-content\"\u003e\n      \u003ca href=\"#\" class=\"nav-scroller-item\"\u003eItem 1\u003c/a\u003e\n      \u003ca href=\"#\" class=\"nav-scroller-item\"\u003eItem 2\u003c/a\u003e\n      \u003ca href=\"#\" class=\"nav-scroller-item\"\u003eItem 3\u003c/a\u003e\n      ...\n    \u003c/div\u003e\n  \u003c/nav\u003e\n\n  \u003cbutton class=\"nav-scroller-btn nav-scroller-btn--left\"\u003e\n    ...\n  \u003c/button\u003e\n\n  \u003cbutton class=\"nav-scroller-btn nav-scroller-btn--right\"\u003e\n    ...\n  \u003c/button\u003e\n\n\u003c/div\u003e\n```\n\n\n\n### Using other tags\nThe demos use a \u0026lt;div\u0026gt; for \"nav-scroller-content\" and \u0026lt;a\u0026gt; tags for the \"nav-scroller-item\" but you can also use a \u0026lt;ul\u0026gt; as below.\n\n```html\n\u003cul class=\"nav-scroller-content\"\u003e\n  \u003cli class=\"nav-scroller-item\"\u003e\u003ca href=\"#\" class=\"nav-scroller-item\"\u003eItem 1\u003c/a\u003e\u003c/li\u003e\n  ...\n```\n\nThe buttons use an svg for the arrow icon but this can be replaced with an image, text or html entities(\u0026lt; \u0026gt;, \u0026larr; \u0026rarr;, \u0026#9668; \u0026#9658;), just update the nav-scroller-button styles as needed.\n\n\n\n## Compatibility\n\n### Browser support\nSupports all modern browsers(Firefox, Chrome and Edge) released as of January 2018. For older browsers you may need to include polyfills for Nodelist.forEach and Element.classList.\n\n\n\n## Demo site\nClone or download from Github.\n\n```javascript\n$ npm install\n$ gulp serve\n```\n\n\n### Credits\n[A horizontal scrolling navigation pattern for touch and mouse with moving current indicator](https://benfrain.com/a-horizontal-scrolling-navigation-pattern-for-touch-and-mouse-with-moving-current-indicator/) by Ben Frain.\u003cbr\u003e\n[A Priority+ Navigation With Scrolling and Dropdowns](https://css-tricks.com/priority-navigation-scrolling-dropdowns/) by Micah Miller-Eshleman on CSS-Tricks.\u003cbr\u003e\n[The Priority+ Navigation Pattern](https://css-tricks.com/the-priority-navigation-pattern/) by Chris Coyier on CSS-Tricks.\n\n\n\n### License\nMIT © Nigel O Toole\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FNigelOToole%2Fpriority-nav-scroller","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FNigelOToole%2Fpriority-nav-scroller","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FNigelOToole%2Fpriority-nav-scroller/lists"}