Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sometimes the images aren't loaded and browser shows error icon until the page is scrolled #151

Open
paolobenve opened this issue Aug 20, 2018 · 4 comments

Comments

@paolobenve
Copy link

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?

@paolobenve
Copy link
Author

Well, I checked more specifically, it's not for the cache...

What is then the reason of this behaviour?

@paolobenve paolobenve changed the title already cached images aren't re-loaded, browser shows error icon sometimes the images aren't loaded and browser shows error icon until the page is scrolled Aug 20, 2018
@paolobenve
Copy link
Author

I modified the title: the problem is that, randomlessly, some visible image isn't unveiled until the page is scrolled. Why?

@jakmedia
Copy link

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.

@jakmedia
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants