Skip to content

Instantly share code, notes, and snippets.

@SubZane
Created August 25, 2016 08:34
Show Gist options
  • Save SubZane/5c84496440bf63b08faec1c3fa1b2dd4 to your computer and use it in GitHub Desktop.
Save SubZane/5c84496440bf63b08faec1c3fa1b2dd4 to your computer and use it in GitHub Desktop.
Force the repaint of an element. Sometimes necessary when adding CSS rules after document loaded.
// Force the repaint of an element. Sometimes necessary when adding CSS rules after document loaded.
function forceRepaint(element) {
element.style.display='none';
var temp = element.offsetHeight;
element.style.display='';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment