-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Conversation
to support refreshes better
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? |
Images are otherwise !:visible in chrome during f5 call go update(). Suggestions? |
URL of the page you have problem with? |
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: 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'}); |
@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 Have you tried the patch on this thread? It essentially does the same as your fix. Does it work 100% for you? |
@tuupola: These images indeed have no dimensions set, setting option I tried v1.8.3 but that version failed +-30% on Safari without my quickfix or setting 'skip_invisible' to false. |
Only proper fix in Webkit browsers is to set width and height either as attributes or in CSS.
Changed jquery from ready to load, this should support refreshes correctly.