
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
position-indicator
Advanced tools
Minimal VanillaJS code to know the scroll position of the page with no external dependencies.
A position indicator that updates on:
It has been tested on
It updates when the devices rotates and if the height changes on interaction.
![]() | ![]() | ![]() |
|---|---|---|
| 60+ | 12+ | 60+ |
| Codesandbox React | View | Edit | |
| Codesandbox Vue | View | Edit | |
| Codesandbox Angular | View | Edit | |
| Codepen Vue | View | Edit |
This library is published in the NPM registry and can be installed using any compatible package manager.
yarn add position-indicator
# For npm, use the command below.
npm install position-indicator --save
import { createPositionIndicator } from 'position-indicator'
let myOnInitCallback = (data) => {}
let myOnUpdateCallback = (data) => {}
// where data is:
let data = {
position /* value between 0 and 1 */,
prevPosition /* value between 0 and 1 */,
hasUpdated /* if position is different from previous event */,
hasScroll /* true or false */,
eventType /* scroll, resize, heightChange or init */,
eventDate /* Date.now() */,
}
let positionIndicator = createPositionIndicator({
onInit: myOnInitCallback,
onUpdate: myOnUpdateCallback,
useResizeListener: true, // optional: default true
useResizeObserver: true, // optional: default true
})
positionIndicator.init()
// Then later when not used anymore
positionIndicator.destroy()
This module has an UMD bundle available through JSDelivr and Unpkg CDNs.
<!-- For UNPKG use the code below. -->
<script src="https://unpkg.com/position-indicator"></script>
<!-- For JSDelivr use the code below. -->
<script src="https://cdn.jsdelivr.net/npm/position-indicator"></script>
<script>
// UMD module is exposed through the "positionIndicator" global variable.
console.log(positionIndicator)
</script>
https://unpkg.com/position-indicator/
Documentation generated from source files by Typedoc.
Released under MIT License.
FAQs
position indicator library
We found that 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.