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

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

    For some reason I couldn't get danorton's answer to work, I could see what it was supposed to do so I tweaked it a little bit to this:

    $('#foo').css('display', 'none').height();
    $('#foo').css('display', 'block');
    

    and it worked for me.

提交回复
热议问题