always scroll to top on page change

This commit is contained in:
Jonatan Nilsson 2019-10-02 17:55:00 +00:00
parent 97c64003a7
commit 48e6d56ec1
2 changed files with 12 additions and 2 deletions

View file

@ -83,9 +83,7 @@ const Frontpage = {
}, },
view: function(vnode) { view: function(vnode) {
console.log(this.articles)
var deviceWidth = window.innerWidth var deviceWidth = window.innerWidth
var bannerPath = '' var bannerPath = ''
if (this.featured && this.featured.banner) { if (this.featured && this.featured.banner) {

View file

@ -1,6 +1,18 @@
const m = require('mithril') const m = require('mithril')
window.m = m window.m = m
m.route.setOrig = m.route.set
m.route.set = function(path, data, options){
m.route.setOrig(path, data, options)
window.scrollTo(0, 0)
}
m.route.linkOrig = m.route.link
m.route.link = function(vnode){
m.route.linkOrig(vnode)
window.scrollTo(0, 0)
}
const Authentication = require('./authentication') const Authentication = require('./authentication')
m.route.prefix = '' m.route.prefix = ''