Maintain Scroll Positions in persistent symbols

I'm pleased to present a utility, named "MaintainScrollPositions", designed to improve the navigation experience within Tumult Hype documents with persistent symbols that have overflow states. This script ensures that scroll positions are preserved and restored as users navigate between scenes or interact with persistent symbols, which may shift within the DOM due to dynamic content adjustments.

Overview

The "MaintainScrollPositions" script addresses a common challenge in interactive web content: maintaining the user's scroll position across scene transitions and during the repositioning of persistent symbols.

Technical Insights

Utilizing Hype's event system, the script captures scroll positions of elements before a scene unloads and stores these values in a temporary object. Upon scene load, it restores the scroll position for each element based on its unique identifier. The script is particularly good at managing the scroll states of persistent symbols, ensuring their scroll position remains consistent despite any changes in their position within the DOM hierarchy. All automatic, all behind the scenes (pun intended :wink:).

MaintainScrollPositions.hype.zip (145,0 KB)

Based on a recent help request, but now made generic.

2 Likes

Lovely. We had this issue on our tracker, but it was lower priority since we didn't hear too many reports encountering it. Was your "recent help request" off the forums, or did I miss it?