Preserves the user's scroll position while DOM mutations change the page.
npm install scroll-anchoringScroll Anchoring preserves the user's scroll position while DOM mutations change the page.
```
$ npm install scroll-anchoring
`js
import {preserveAnchorNodePosition} from 'scroll-anchoring'
const comments = document.getElementById('comments')
preserveAnchorNodePosition(document, () => {
comments.insertAdjacentHTML('beforeend', newCommentHtml)
})
`
- Chrome
- Firefox
- Safari
- Internet Explorer 11
- Microsoft Edge
```
npm install
npm test
- CSS Scroll Anchoring Module Level 1
- WICG/ScrollAnchoring
- Chrome Platform Status - Intervention: Scroll Anchoring
Distributed under the MIT license. See LICENSE for details.