client/general: scroll to top on page change
This commit is contained in:
parent
906eddc61f
commit
f083e5fdc8
|
@ -3,6 +3,12 @@
|
||||||
require('./util/polyfill.js');
|
require('./util/polyfill.js');
|
||||||
|
|
||||||
const page = require('page');
|
const page = require('page');
|
||||||
|
const origPushState = page.Context.prototype.pushState;
|
||||||
|
page.Context.prototype.pushState = function() {
|
||||||
|
window.scrollTo(0, 0);
|
||||||
|
origPushState.call(this);
|
||||||
|
};
|
||||||
|
|
||||||
const mousetrap = require('mousetrap');
|
const mousetrap = require('mousetrap');
|
||||||
page(/.*/, (ctx, next) => {
|
page(/.*/, (ctx, next) => {
|
||||||
mousetrap.reset();
|
mousetrap.reset();
|
||||||
|
|
Loading…
Reference in New Issue