@profiscience/knockout-contrib-router-middleware-scroll-position
v2.0.17
Published
[![Version][npm-version-shield]][npm] [![Dependency Status][david-dm-shield]][david-dm] [![Peer Dependency Status][david-dm-peer-shield]][david-dm-peer] [![Dev Dependency Status][david-dm-dev-shield]][david-dm-dev] [![Downloads][npm-stats-shield]][npm-sta
Downloads
30
Readme
router.middleware.scrollPosition
Add support for:
- restoring scroll position on back-button navigation
- scrolling to anchors (#hash), or the top on forward navigation
Usage
import {
Router,
createScrollPositionMiddleware
} from '@profiscience/knockout-contrib'
Router.use(
createScrollPositionMiddleware({
// optionally supply a custom scroll function (add smooth scrolling, use Velocity, etc.)
scrollTo(x, y) { ... }
})
)