How can I force WebKit to redraw/repaint to propagate style changes?

后端 未结 27 2360
我寻月下人不归
我寻月下人不归 2020-11-22 02:04

I have some trivial JavaScript to effect a style change:

sel = document.getElementById(\'my_id\');
sel.className = sel.className.replace(/item-[1-9]-selected         


        
27条回答
  •  臣服心动
    2020-11-22 02:36

    The following works. It only has to be set once in pure CSS. And it works more reliably than a JS function. Performance seems unaffected.

    @-webkit-keyframes androidBugfix {from { padding: 0; } to { padding: 0; }}
    body { -webkit-animation: androidBugfix infinite 1s; }
    

提交回复
热议问题