
Security News
Opengrep Adds Apex Support and New Rule Controls in Latest Updates
The latest Opengrep releases add Apex scanning, precision rule tuning, and performance gains for open source static code analysis.
reading-position-indicator
Advanced tools
Small mobile friendly reading position indicator library with no dependencies.
http://codepen.io/kunukn/full/zNJqEE
A position indicator at the top of the page to visually display how far you have scrolled on a webpage.
Build with focus on simplicity, performance and a11y. Using transform translate for best performance. rAF for throttling scroll update and debounce for resize update.
Aria tags are used to support screen readers.
The progress element <progress>
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.
![]() | ![]() | ![]() | ![]() | ![]() |
---|---|---|---|---|
IE 10+ ✔ | Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ |
~5kb
<1kb
Tested with latest Chrome, Safari, Firefox, Edge, IE10+, iOS7+, Android 4.3+
Check the dist/index.html for inspiration.
rpi.bundle.js
and rpi.bundle.css
in the html page<head>
...
<link rel="stylesheet" href="rpi.bundle.css">
...
</head>
<body>
<!-- library markup -->
<div id="rpi-progress-bar-container"
class="rpi-progress-bar-container"
role="progressbar"
aria-valuemin="0"
aria-valuemax="100"
aria-valuenow="0">
<div class="rpi-progress-bar-container__position" aria-hidden="true"></div>
<div class="rpi-progress-bar-container__percentage"></div>
</div>
<!-- end library markup -->
...
<script src="rpi.bundle.js"></script> <!-- library -->
<script>new ReadingPositionIndicator().init();</script> <!-- usage -->
</body>
<div id="rpi-progress-bar-container" class="rpi-progress-bar-container">
<div class="rpi-progress-bar-container__position"></div>
<div class="rpi-progress-bar-container__percentage"></div>
</div>
var rpi = new ReadingPositionIndicator({
color: 'navyblue', // progress bar color
percentage: {
show: true,
opacity: .3,
color: '#000',
},
}).init();
//rpi.destroy(); // use when to be removed
It uses JS to calculate the document height and the viewport height to calculate the current position. The calculation is updated on scroll and resize event and the information is updated to the markup.
MIT License: http://opensource.org/licenses/MIT
1.0.0
FAQs
Reading position indicator on a webpage
The npm package reading-position-indicator receives a total of 86 weekly downloads. As such, reading-position-indicator popularity was classified as not popular.
We found that reading-position-indicator demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The latest Opengrep releases add Apex scanning, precision rule tuning, and performance gains for open source static code analysis.
Security News
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
Research
/Security News
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.