Setup:
So, I have a narrow but long table (width:200px, height:2000px ish). This table is wrapped inside another div with fix height (300px) and overflow-y:scroll, giving a fixed height visible area. In the table, there is a lot of cells that are stacked vertically (see image and markup is simple regular table wrapped in a div).
Problem:
Each cell contains images, so if there are lots of cells that the page has to fetch including the images and data before loading the site then it will slow down the site significantly.
Solution Approach:
I am thinking of two approaches.
Apply lazy-load
to images only. In this case (for example, from the image above). all three sections (section 1, 2 and 3) will be fully loaded except images that are not visible yet. Although it will minimize the delay if it has to fetch lots of data (for example 100+ cells), then I am not sure if it is the best approach.
Another approach is little bit more complicated but will minimize the delay as much as possible and is really ideal. So, when the page is first loaded, only the section-1
will be visible but section-2
will be also loaded (either with images or lazy-loaded images. However
section-3will not be loaded at this point.
When the user scrolls to the
section-2then the
section-3will be automatically loaded but not visible until user scrolls down. If
section-3is in the viewpoint, then
section-4` will be loaded but not visible. You get the point.
Any thoughts on it and how-to?
Thanks.
答案 0 :(得分:2)