How to force ie8 to repaint after adding a class to a dom element

后端 未结 6 986
旧时难觅i
旧时难觅i 2021-02-01 05:52

In ie8 if elements don\'t \'repaint\' with the associated css when you change the classname, how can you force the browser to refresh and not kill ie8 performance?

This

6条回答
  •  爱一瞬间的悲伤
    2021-02-01 06:21

    The correct answer to this question is that you need to actually change the content rule.

    .black-element:before { content:"Hey!"; color: #000;}
    .red-element:before { content:"Hey! "; color: #f00;}
    

    Notice the extra space I added after Hey! on .red-element

提交回复
热议问题