Rich-Harris / ramjet

Morph DOM elements from one state to another with smooth animations and transitions

Home Page:http://www.rich-harris.co.uk/ramjet/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

scrollTop is not cloned

callumlocke opened this issue · comments

If you're transitioning from/to an element with overflow:auto/scroll, and which the user has already scrolled before ramjetting, this causes an ugly jump at the beginning/end of the transition, breaking the illusion.

It's also possible that it's not the outer element but some descendent that is scrollable... So to fix this properly you'd need to walk through all descendent elements and copy over the scrollTop for each one (if it's not 0). Not sure how feasible that is.

I would suggest to use the overrideClone function for creating a clone that includes the scroll. I am closing it but open to further discussion ...