A
A
Alexander2019-08-14 23:15:27
css
Alexander, 2019-08-14 23:15:27

How to apply style and change scrollTop at the same time?

There is a need at some point to apply the position: fixed style to the element containing the page content and at the same moment set the scrollTop of this element equal to the scrollTop of the entire page. As a result, it turns out that we imperceptibly transfer all the scrollable content of the site to a separate fixed-positioned scrollable layer with the same scroll position. In theory, this transition should be invisible to the user, and so it is in chrome and in most cases in safari. But still in safari this is not always the case and sometimes a frame skips with an unscrolled layer. That is, it is clear that the content was redrawn to a separate layer, but not scrolled to the same position as it was. Is there any way to make this transition completely monolithic?
PS: It would be possible, in theory, to use Display Locking, but at the moment it is only in the latest chrome, and everything is in order there.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question