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

后端 未结 27 2684
我寻月下人不归
我寻月下人不归 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:28

    I had this problem with a a number of divs that were inserted in another div with position: absolute, the inserted divs had no position attribute. When I changed this to position:relative it worked fine. (was really hard to pinpoint the problem)

    In my case the elements where inserted by Angular with ng-repeat.

提交回复
热议问题