5 ms·
Just determining whether or not the user can see an image is quite tricky when you consider that there are a number of things which could cause it to be invisib
by NathanKP 13y ago
Just determining whether or not the user can see an image is quite tricky when you consider that there are a number of things which could cause it to be invisible to the user and thus safe to remove:
* It might be placed as a normal block element on the page but out of the current viewport.
* It might have had visibility: hidden CSS statement applied to it.
* It might have had display: none CSS statement applied to it.
* It might have the alpha channel set to fully transparent and then fade in.
* It might be inside a <div> that has overflow: scroll and then have that specific div scrolled such that the image is outside the viewport of that <div>
* It might be using top and left CSS properties to animate the position of the element such that it is off the screen.
* It might have it's CSS width or height set to 0 so that it can be start out "hidden" and then have animate open.
So I wouldn't discount this as just a simple solution because I see a lot of edge cases where things could get confusing just due to the complexity of how many ways there are for a page element to be visible versus not visible.