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

后端 未结 6 897
旧时难觅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:26

    Ridiculously, this works:

    function ie8Repaint(element) {
        element.html(element.html().replace('>', '>'));
    }
    

    Nothing actually changes in the DOM so it won't affect any other browsers.

提交回复
热议问题