scroll-anchoring

0.1.0 • Public • Published

scroll-anchoring

Scroll Anchoring preserves the user's scroll position while DOM mutations change the page.

Installation

$ npm install scroll-anchoring

Usage

import {preserveAnchorNodePosition} from 'scroll-anchoring'
 
const comments = document.getElementById('comments')
preserveAnchorNodePosition(document, () => {
  comments.insertAdjacentHTML('beforeend', newCommentHtml)
})

Browser support

  • Chrome
  • Firefox
  • Safari
  • Internet Explorer 11
  • Microsoft Edge

Development

npm install
npm test

See Also

License

Distributed under the MIT license. See LICENSE for details.

Readme

Keywords

none

Package Sidebar

Install

npm i scroll-anchoring

Weekly Downloads

5,986

Version

0.1.0

License

MIT

Unpacked Size

12.5 kB

Total Files

7

Last publish

Collaborators

  • josh