Rich-Harris / ramjet

Morph DOM elements from one state to another with smooth animations and transitions
http://www.rich-harris.co.uk/ramjet/
MIT License
5.45k stars 158 forks source link

scrollTop is not cloned #41

Closed callumlocke closed 9 years ago

callumlocke commented 9 years ago

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.

sithmel commented 9 years ago

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 ...