Open paolobenve opened 5 years ago
Well, I checked more specifically, it's not for the cache...
What is then the reason of this behaviour?
I modified the title: the problem is that, randomlessly, some visible image isn't unveiled until the page is scrolled. Why?
I get the same behavior when using jQuery 3.3.1. It works as expected on older versions of jQuery for me. I'm not sure how to fix this though.
SOLVED – If you are using jQuery 3.3.1 you need to change the second line of your Javascript code.
$("img").unveil(200, function() { $(this).load(function() { this.style.opacity = 1; }); });
Change the line of code in bold above to this:
$(this).on('load', function() {
Worked for me. No more Javascript errors in the browser.
If I visit a page and scroll so that all images unveil, then go to other page and come back to the first, images are already in browser cache, so it seems that unveil isn't triggered again, and the browser shows the error icon.
Is there any work around?