fixed last of scroll position view in portrait mode to remember & display user's last line at bottom of applet viewport
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
This commit is contained in:
@@ -7,10 +7,12 @@
|
|||||||
var scroll = document.getElementById('id_drama_scroll');
|
var scroll = document.getElementById('id_drama_scroll');
|
||||||
if (!scroll) return;
|
if (!scroll) return;
|
||||||
|
|
||||||
|
// Defer dimension-dependent work until after flex layout resolves.
|
||||||
|
// Inline scripts can run before nested flex heights are computed, producing
|
||||||
|
// wrong scrollHeight/clientHeight values (symptom: incorrect marginTop on mobile).
|
||||||
|
requestAnimationFrame(function() {
|
||||||
// Push buffer so its top aligns with the bottom of the aperture when all
|
// Push buffer so its top aligns with the bottom of the aperture when all
|
||||||
// events fit within the viewport (no natural scrolling). For longer scrolls
|
// events fit within the viewport (no natural scrolling).
|
||||||
// the buffer top naturally appears at the aperture bottom when the last event
|
|
||||||
// clears the top of the visible area.
|
|
||||||
var buffer = scroll.querySelector('.scroll-buffer');
|
var buffer = scroll.querySelector('.scroll-buffer');
|
||||||
if (buffer) {
|
if (buffer) {
|
||||||
var eventsHeight = scroll.scrollHeight - buffer.offsetHeight;
|
var eventsHeight = scroll.scrollHeight - buffer.offsetHeight;
|
||||||
@@ -22,6 +24,7 @@
|
|||||||
|
|
||||||
// Restore: position stored is bottom-of-viewport; subtract clientHeight to align it
|
// Restore: position stored is bottom-of-viewport; subtract clientHeight to align it
|
||||||
scroll.scrollTop = Math.max(0, {{ scroll_position }} - scroll.clientHeight);
|
scroll.scrollTop = Math.max(0, {{ scroll_position }} - scroll.clientHeight);
|
||||||
|
});
|
||||||
|
|
||||||
// Animate "What happens next. . . ?" buffer dots — 4th span shows '?'
|
// Animate "What happens next. . . ?" buffer dots — 4th span shows '?'
|
||||||
var dotsWrap = scroll.querySelector('.scroll-buffer-dots');
|
var dotsWrap = scroll.querySelector('.scroll-buffer-dots');
|
||||||
|
|||||||
Reference in New Issue
Block a user