How can I change the CSS visibility style for elements that are not on the screen?
        Posted  
        
            by RenderIn
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by RenderIn
        
        
        
        Published on 2010-04-29T20:42:48Z
        Indexed on 
            2010/04/29
            20:47 UTC
        
        
        Read the original article
        Hit count: 424
        
I have a lot of data being placed into a <DIV> with the overflow: auto style.  Firefox handles this gracefully but IE becomes very sluggish both when scrolling the div and when executing any Javascript on the page.
At first I thought IE just couldn't handle that much data in its DOM, but then I did a simple test where I applied the visibility: hidden style to every element past the first 100.  They still take up space and cause the scrollbars to appear.  IE no longer had a problem with the data when I did this.
So, I'd like to have a "smart" div that hides all the nested div elements which are not currently visible on the screen. Is there a simple solution to this or will I need to have an infinite loop which calculates the location of the scrollbar? If not, is there a particular event that I can hook into where I could do this? Is there a jQuery selector or plugin that will allow me to select all elements not currently visible on the screen?
© Stack Overflow or respective owner