Not sure exactly what you're trying to achieve but this is a method I have used in the past with success to force the browser to redraw, maybe it will work for you. Making it worse, if you drop that timeout below 500ms (to where it would be less noticeable), it often won't have the desired effect, since the browser won't get around to redrawing before it goes back to its original state.Īnybody care to offer a better version of this redraw/refresh hack (preferably based on the first example above) that works on Chrome/Mac? $(el).css("border", "solid 0px transparent") Īs in, actually force the element to jump a bit, then chill a second and jump it back. Thus far, the best I've come up with to get the same effect on Chrome/Mac is this piece of ugliness: $(el).css("border", "solid 1px transparent") Unfortunately, the bright team behind Chrome for the Mac seem to have found a way to get that offsetHeight without redrawing. This works in most browser/os combinations: el.style.cssText += ' -webkit-transform:rotateZ(0deg)'Įl.style.cssText += ' -webkit-transform:none'Īs in, tweak some unused CSS property, then ask for some information that forces a redraw, then untweak the property.
#Refresh button for mac chrome code
This happens frequently (and predictably) enough in a project I'm working on that I've put code in place to force a redraw in certain circumstances. Digging in through the DOM inspector is often enough to get it to realize the error of its ways and redraw correctly, so it's provably the case that the markup is good.
![refresh button for mac chrome refresh button for mac chrome](https://www.maciverse.com/wp-content/uploads/2010/12/system-preferences-screenshot.png)
Every once in a while, Chrome will render perfectly valid HTML/CSS incorrectly or not at all.