I have some simple code where I check an image's width and height, and if it's not >= 120x90, it gets a visibility: hidden
put on it.
$(".video-thumbnail").each(function() {
var width = $(this).prop("naturalWidth");
var height = $(this).prop("naturalHeight");
if (width <= 120 && height <= 90) {
$(this).css("visibility", "hidden");
}
});
The problem is this randomly fails on some page reloads (see edit below).
I think it may be a caching or browser loading delay issue.
EDIT
Confirmed sequence of events to reproduce:
- Images are cached in browser
- Modify HTML source
- Navigate to page (not reload)
Any suggestions to run this more reliably? Maybe force the browser to download the image file? Not sure what that would look like.