intermine / bluegenes

A friendly next-generation interface for Genomic data discovery powered by InterMine
http://bluegenes.apps.intermine.org
Other
76 stars 57 forks source link

Defer loading of im-tables/viz outside viewport #745

Open heralden opened 3 years ago

heralden commented 3 years ago

This should help a lot with the initial loading time of the page. Might be difficult to make it work smoothly though.

https://stackoverflow.com/questions/123999/how-can-i-tell-if-a-dom-element-is-visible-in-the-current-viewport/7557433#7557433

This can be short-circuited, meaning as soon as we find an element outside and below the viewport (starting from the top), we can assume that all proceeding elements (below it) are also outside the viewport. It might work better as a setInterval instead of scroll listener, as that would help us avoid loading elements that are skipped if the user uses the ToC to skip to a specific section.