mirror of
https://github.com/flarum/framework.git
synced 2025-02-21 09:11:40 +08:00
Fix browser back button losing scroll position. ref #835
This commit is contained in:
parent
beb2f91fef
commit
e2e5ac8c0c
8
js/forum/dist/app.js
vendored
8
js/forum/dist/app.js
vendored
@ -23455,7 +23455,13 @@ System.register('flarum/components/IndexPage', ['flarum/extend', 'flarum/compone
|
||||
var scrollTop = app.cache.scrollTop;
|
||||
|
||||
$('#app').css('min-height', $(window).height() + heroHeight);
|
||||
$(window).scrollTop(scrollTop - (app.cache.heroHeight - heroHeight));
|
||||
|
||||
// Scroll to the remembered position. We do this after a short delay so that
|
||||
// it happens after the browser has done its own "back button" scrolling,
|
||||
// which isn't right. https://github.com/flarum/core/issues/835
|
||||
setTimeout(function () {
|
||||
return $(window).scrollTop(scrollTop - app.cache.heroHeight + heroHeight);
|
||||
}, 1);
|
||||
|
||||
app.cache.heroHeight = heroHeight;
|
||||
|
||||
|
@ -103,7 +103,11 @@ export default class IndexPage extends Page {
|
||||
const scrollTop = app.cache.scrollTop;
|
||||
|
||||
$('#app').css('min-height', $(window).height() + heroHeight);
|
||||
$(window).scrollTop(scrollTop - (app.cache.heroHeight - heroHeight));
|
||||
|
||||
// Scroll to the remembered position. We do this after a short delay so that
|
||||
// it happens after the browser has done its own "back button" scrolling,
|
||||
// which isn't right. https://github.com/flarum/core/issues/835
|
||||
setTimeout(() => $(window).scrollTop(scrollTop - app.cache.heroHeight + heroHeight), 1);
|
||||
|
||||
app.cache.heroHeight = heroHeight;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user