{"id":13447625,"url":"https://github.com/kunukn/reading-position-indicator","last_synced_at":"2025-07-29T16:33:29.366Z","repository":{"id":57348682,"uuid":"81429068","full_name":"kunukn/reading-position-indicator","owner":"kunukn","description":"Small mobile friendly reading position indicator library with no external dependencies","archived":false,"fork":false,"pushed_at":"2023-03-02T04:35:57.000Z","size":2666,"stargazers_count":20,"open_issues_count":5,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-11-08T04:45:42.253Z","etag":null,"topics":["progress-bar"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/kunukn.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":"2017-02-09T08:47:05.000Z","updated_at":"2021-07-18T10:18:33.000Z","dependencies_parsed_at":"2024-10-28T12:19:14.525Z","dependency_job_id":"320db475-35b2-4cf4-87a7-5e14f164c15a","html_url":"https://github.com/kunukn/reading-position-indicator","commit_stats":{"total_commits":77,"total_committers":4,"mean_commits":19.25,"dds":0.06493506493506496,"last_synced_commit":"12fe2cebfbd40a0c66f0d5a85faca79ff3143c79"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kunukn%2Freading-position-indicator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kunukn%2Freading-position-indicator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kunukn%2Freading-position-indicator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kunukn%2Freading-position-indicator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kunukn","download_url":"https://codeload.github.com/kunukn/reading-position-indicator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228030026,"owners_count":17858432,"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":["progress-bar"],"created_at":"2024-07-31T05:01:22.769Z","updated_at":"2024-12-04T02:13:36.643Z","avatar_url":"https://github.com/kunukn.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# reading position indicator\nSmall mobile friendly reading position indicator library with no external dependencies.\n\n# newer library\nA newer library exists here.\u003cbr/\u003e\nhttps://github.com/kunukn/position-indicator\n\nThis is more flexible and easier to integrate with UI libraries like React, Vue and Angular.\n\n# demo\n* https://codepen.io/kunukn/full/zNJqEE (version 1.0.3+)\n* https://codepen.io/kunukn/full/ayeMZN/ (version 2.0.0+)\n\n\u003cimg src=\"https://github.com/kunukn/reading-position-indicator/blob/master/media/rpi.gif?raw=true\" width=\"300\"\u003e\n\n# about\nA position indicator at the top of the page to visually display how far you have scrolled on a webpage.\n\nBuild with focus on **simplicity**, **performance** and **a11y**. \nUsing transform translate for best performance. rAF for throttling scroll update and debounce for resize update. \n\n**Aria tags** are used to support screen readers. \n\nThe progress element `\u003cprogress\u003e` has not been used because the code gets messy with vendor prefixes and removing the default styles that comes with each browser. It gets even messier when fallback elements are added inside the progress element to support older browsers.\n\n\n# browser support\n\n![IE](https://cdnjs.cloudflare.com/ajax/libs/browser-logos/70.0.0/archive/internet-explorer_9-11/internet-explorer_9-11_48x48.png) | ![Chrome](https://cdnjs.cloudflare.com/ajax/libs/browser-logos/70.0.0/chrome/chrome_48x48.png) | ![Firefox](https://cdnjs.cloudflare.com/ajax/libs/browser-logos/70.0.0/firefox/firefox_48x48.png) | ![Opera](https://cdnjs.cloudflare.com/ajax/libs/browser-logos/70.0.0/opera/opera_48x48.png) | ![Safari](https://cdnjs.cloudflare.com/ajax/libs/browser-logos/70.0.0/safari-ios/safari-ios_48x48.png)\n--- | --- | --- | --- | --- |\nIE 11 ✔ | Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ |\n\n\n# npm\n\nhttps://www.npmjs.com/package/reading-position-indicator\n\n\n# size\n* js `~6kb`\n* css `\u003c1kb`\n\n# test\nTested with latest Chrome, Safari, Firefox, Edge, IE10+, iOS7+, Android 4.3+\n\n# usage\n\nCheck the **dist/index.html** for inspiration.\n\n* Add reference to `rpi.bundle.js` and `rpi.bundle.css` in the html page\n* Apply the markup structure\n* Init the library with JS\n\n### html structure\n\n```html\n\u003chead\u003e\n  ...\n  \u003clink rel=\"stylesheet\" href=\"rpi.bundle.css\"\u003e\n  ...\n\u003c/head\u003e\n\u003cbody\u003e\n  \u003c!-- library markup --\u003e\n  \u003cdiv class=\"rpi-progress-bar\" \n    role=\"progressbar\" \n    aria-valuemin=\"0\" \n    aria-valuemax=\"100\"\n    aria-valuenow=\"0\"\u003e\n      \u003cdiv class=\"rpi-progress-bar__position\" aria-hidden=\"true\"\u003e\u003c/div\u003e\n      \u003cdiv class=\"rpi-progress-bar__percentage\"\u003e\u003c/div\u003e\n  \u003c/div\u003e\n  \u003c!-- end library markup --\u003e\n  \n       ...          \n       \n       \u003cscript src=\"rpi.bundle.js\"\u003e\u003c/script\u003e \u003c!-- library --\u003e\n       \u003cscript\u003enew ReadingPositionIndicator().init();\u003c/script\u003e \u003c!-- usage --\u003e\n \u003c/body\u003e\n```\n\n### minimum markup required\n\n```html\n\u003cdiv class=\"rpi-progress-bar\"\u003e\n      \u003cdiv class=\"rpi-progress-bar__position\"\u003e\u003c/div\u003e\n      \u003cdiv class=\"rpi-progress-bar__percentage\"\u003e\u003c/div\u003e\n\u003c/div\u003e\n```\n\n### configuration and usage example\n\n```javascript\nvar rpi;\nsetTimeout(function waitUntilDomIsReadyLoadingCustomFontsMightOffsetThis() {\n  rpi = new ReadingPositionIndicator({\n    rpiArea: '[data-rpi-area]', /* optional, query selector to an element */\n    progressBar: { /* optional */\n      show: true, /* default true */\n      color: 'rgba(0, 120, 120, .5)', /* default from css */\n    },\n    percentage: { /* optional */\n      show: true, /* default false */\n      displayBeforeScroll: false, /* default false */\n      opacity: .3, /* default from css */\n      color: '#000', /* default from css */\n    },\n  }).init();\n}, 200); // wait until DOM has fully rendered the article to get the calculations correct\n// rpi.destroy(); // use when to be removed\n// rpi.update(); // optional force update, example: DOM was updated and need to refresh the indicator\n```\n\n\n# development\n* git clone the project or download it\n* npm install\n* npm start\n* open a browser and go to localhost:3333\n\n# build library into dist folder\n* npm run build \n\n# how does it work?\n\nIt calculate heights for viewport, document and current scroll position. If rpiArea is used then it also uses getBoundingClientRect method to calculate dom element dimension. DOM updates are only applied if data has changed since last time. The calculation is updated on scroll and resize event and the information is updated to the DOM.\n\n\n# license\n\nMIT License: http://opensource.org/licenses/MIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkunukn%2Freading-position-indicator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkunukn%2Freading-position-indicator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkunukn%2Freading-position-indicator/lists"}