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

Use window.load instead of document.ready #70

Closed
wants to merge 1 commit into from
Closed

Use window.load instead of document.ready #70

wants to merge 1 commit into from

Conversation

ghost
Copy link

@ghost ghost commented Nov 18, 2012

Changed jquery from ready to load, this should support refreshes correctly.

@tuupola
Copy link
Owner

tuupola commented Nov 19, 2012

What this does is that it waits for all the elements in page (including images) to be loaded before it calls update. What problem does this fix and could you also give example URL for that page so I could check?

@ghost
Copy link
Author

ghost commented Nov 19, 2012

Images are otherwise !:visible in chrome during f5 call go update(). Suggestions?

@tuupola
Copy link
Owner

tuupola commented Nov 19, 2012

URL of the page you have problem with?

@lmeurs
Copy link

lmeurs commented Nov 30, 2012

Same here in Chrome 23 on Windows 7 and Safari 6 on OSX: on page refresh the lazy load images do not load. My personal solution is to trigger the scroll event on window load to trigger lazy load. This way other browsers still trigger lazy load on DOM ready.

I am sorry that I do not have a test URL for you, am in the middle of development.

@tuupola
Copy link
Owner

tuupola commented Dec 12, 2012

@lmeurs Can you try 1.8.3 if it fixes the problem.

@lmeurs
Copy link

lmeurs commented Dec 13, 2012

@tuupola: Thank you for the effort. The built in delay does work on my W7 Chrome v23.0.1271, but not always on my OSX v10.7.5 Safari v6.0.2, maybe 30% failure. I tried both the old and new versions of Lazyload on both systems multiple times.

My personal quickfix of triggering update() on window load does seem to work 100%.

jQuery('img.lazyload').lazyload({event: 'scroll load'});

@tuupola
Copy link
Owner

tuupola commented Dec 13, 2012

@lmeurs I would guess your images do not have width and height set? Thats is the reason why Webkit sees them as size 0x0 and causes jQuery to assume they are not visible. You could also try setting skip_invisible to false.

Have you tried the patch on this thread? It essentially does the same as your fix. Does it work 100% for you?

@lmeurs
Copy link

lmeurs commented Dec 13, 2012

@tuupola: These images indeed have no dimensions set, setting option skip_invisible: false solves the problem as well.

I tried v1.8.3 but that version failed +-30% on Safari without my quickfix or setting 'skip_invisible' to false.

@tuupola
Copy link
Owner

tuupola commented Dec 17, 2012

Merged in 1.8.x

@lmeurs I went for window.load route. Hope this will fix the problem for you too. If not skip_invisible trick should work.

@tuupola tuupola closed this Dec 17, 2012
tuupola added a commit that referenced this pull request Feb 13, 2013
Only proper fix in Webkit browsers is to set width and height either as attributes or in CSS.
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

Successfully merging this pull request may close these issues.

2 participants