In my code, I have to remove a class, to get its full height. This is being done in requestAnimationFrame
, but removing the class then querying scrollHeight
will force a reflow. Do I simply need to query scrollHeight
in setTimeout
?
requestAnimationFrame(() => {
poo.style.overflow = 'visible';
poo.scrollHeight;
// Do something with it
poo.style.overflow = 'auto';
});
Into...?
requestAnimationFrame(() => {
poo.style.overflow = 'visible';
setTimeout(() => {
poo.scrollHeight;
// Do something with it
poo.style.overflow = 'auto';
}, 0);
});