Search code examples
javascriptperformancecss-tables

Why show/hide table it's so computationally expensive?


I'm working with quite big table and because I'm doing some formatting in Javascript after the table has been downloaded, I want to hide the table (display:none) until it's ready (than I change to ("display","")). It's working right, the only problem it's super slow in IE8, but if I don't hide the table it's super fast, why? Is there a way to avoid this? (My problem is that I'm showing a ugly table to the user and than I change it in front of his face, I don't like this)


Solution

  • Try setting the style.visibility to hidden/visible instead of setting display. This will allow the table to maintain its position, which removes the need for a page redraw.