From f083e5fdc896a4a2eab6dfcd8e7eb04ca47afee5 Mon Sep 17 00:00:00 2001 From: rr- Date: Sun, 8 May 2016 18:56:08 +0200 Subject: [PATCH] client/general: scroll to top on page change --- client/js/main.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/client/js/main.js b/client/js/main.js index 0245e5e..c9e0747 100644 --- a/client/js/main.js +++ b/client/js/main.js @@ -3,6 +3,12 @@ require('./util/polyfill.js'); 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'); page(/.*/, (ctx, next) => { mousetrap.reset();