pja-uq
Last Updated: February 25, 2016
·
642
· iam4x

Ask webkit iOS a repaint

On iOS6 I had a problem with elements not rendered after changing page in my JS SinglePageApp.

To resolve that, I needed to ask webkit to repaint the view. Two solutions :

forceRedraw: (el) ->
    element = $(el)
    newEl = document.createTextNode(' ')
    element.append(newEl)
    newEl.parentNode.removeChild newEl
    element

And the magic one \o/ :

el.style.webkitTransform = el.style.webkitTransform
Say Thanks
Respond