I am drawing a table using a function after data is received from a GET request.
After I draw the table, I want to hold the scroll position relative to the previous table that was there before (all tables have overflow:auto;
).
The way I overcome this problem is as follows:
- listen to the scroll
- store the scroll position in sessionStorage
- After the new table is drawn, I use
.scrolLeft = sessionStorage.getItem('PosY')
This works fine as it does what I want it to do, but I get the following from Chrome Dev.
[Violation] Forced reflow while executing JavaScript took 51ms
I understand why I get this from Chrome Dev. but I want to know if there is another way to do this that will not give me this [Violation]
I have looked into listening to the DOM and repositioning upon changes, but this gives the same [Violation]
Any suggestions would be much appreciated, especially if there is some simple CSS.
No jQuery OR other Libraries, please.