UNPKG

react-router

Version:
24 lines (19 loc) 543 B
var LocationActions = require('../actions/LocationActions'); /** * A scroll behavior that attempts to imitate the default behavior * of modern browsers. */ var ImitateBrowserBehavior = { updateScrollPosition: function (position, actionType) { switch (actionType) { case LocationActions.PUSH: case LocationActions.REPLACE: window.scrollTo(0, 0); break; case LocationActions.POP: window.scrollTo(position.x, position.y); break; } } }; module.exports = ImitateBrowserBehavior;