When I insert a large element to the top of container, it will lose scroll position in Safari.
this.container.insertBefore(someLargeElement, first);
But when in Chrome it work fine.
How can I get same effect?
I try to use this code, but it will get crash when scroll fast:
var beforeTop = this.container.scrollTop;
var beforeHeight = this.container.scrollHeight;
this.container.insertBefore(sectionBefore, first);
var afterHeight = this.container.scrollHeight;
var addHeight = afterHeight - beforeHeight;
this.container.scrollTo(0, beforeTop + addHeight);