7 ms·
Could affect rendering though, since the browser may treat the js as content to render. Probably should be benchmarked to make any conclusions.
by troels 12y ago
Could affect rendering though, since the browser may treat the js as content to render. Probably should be benchmarked to make any conclusions.
- eric_h 12y agoIn my experience, anything with display:none is not rendered by the browser and doesn't take up any real resources. I've used this trick with infinite side scrolling slide show type interfaces when I found that beyond about 20 elements, things started slowing to a crawl. Setting offscreen elements to display:none fixed it right up.
- igrigorik 12y ago"Doesn't take up any real resources" is anything but true. An iframe in particular is basically a new render process, which adds a lot of overhead. Just because you've set "display:none" on an element doesn't mean it's free.