-
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
In case of JQuery AJAX, Images that are visible on the page don't load until I scroll a bit #98
Comments
I use the following snippet.
|
Thanks Brandon, Currently, I am calling $.lazyload() again after loading data via AJAX. But in this case, It loads the already loaded images again & when we scroll the page, there is a bit flickering when I view already loaded images. I hope, your snippet will solve my problem. |
@Brandon0: Thanks for your workaround. I noticed that adding it to the
|
This should be fixed in 1.8.5. Can you try with the latest and reopen the issue if problems still exist. There is also an AJAX(H) demopage. |
Hey guys, just a heads up that this problem seems to persist if you are using the failure_limit show an initial image that is not in the order of the html. $(window).trigger('resize'); also solves this problem. Just a heads up incase anyone else come across this. |
After scrolling and in initial pageload plugin loops though unloaded images. Loop checks if image has become visible. By default loop is stopped when first image outside viewport is found. This is based on following assumption. Order of images on page is same as order of images in HTML code. With some layouts assumption this might be wrong. You can control loading behaviour with failure_limit setting. $("img.lazy").lazyload({
failure_limit : 10
}); Setting failure_limit to 10 causes plugin to stop searching for images to load after finding 10 images below the fold. If you have a funky layout set this number to something high. Worst case being the actual number of images. If I understood correctly your initial image is somewhere far away in the DOM. Just increase the amount of |
Didn't think of increasing my initial Thanks for this! |
First of all, thanks for this wonderful plugin.
It works fine if I put the all the image in my page. But If I Load the data (images) using JQuery AJAX, then it doesn't show the original image (data-original path) which are visible in the view port. It shows the "gray.gif" image. But If I slightly move the scroll bar, it show actual image (data-original). Below is the code which I am using:
On First page load:
$("img.lazy").lazyload({effect: "fadeIn", threshold: 200 });
in first page load, I am showing approx 30 images & I have paging buttons. when user
press the next button I load the data using JQuery AJAX. After loading & binding the
data, I again call the lazyload method.
var jxhr = $.ajax({
// required options
}).done(function (data) {
// code to bind data
$("img.lazy").lazyload({effect: "fadeIn", threshold: 200 });
});
& after loading the data via ajax, there are approx 10 images which are visible in view port.
But plugin doesn't show the actual images of these visible images. If I move scroll bar a bit, It loads these images.
Please suggest me what should I do?
The text was updated successfully, but these errors were encountered: