GeotrekCE / Geotrek-rando-v3

Geotrek public data website (version 3)
https://geotrek.fr/produit.html#rando
MIT License
16 stars 16 forks source link

Improvement of the triggering of detail page sections #1252

Open dtrucs opened 1 week ago

dtrucs commented 1 week ago

In detail pages, there are interactions between the sections being viewed (presentation, practical information, report, etc.) and other parts of the page, such as the map or the anchor menu.

To handle these interactions, the position and height of each section are calculated several times (when scrolling and resizing the window) to determine which section is currently being viewed and which is not. As a result of asynchronous changes in section heights (lazy image loading, widget taking a while to load, etc.), the calculation can fail and triggering accuracy is poorer.

The whole calculation process is a bit artisanal, and we should remedy this by using the dedicated intersection observer API (currently used by geotrek rando widget).