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

Not replace "src" with actual value. #101

Closed
rscouto opened this issue Mar 18, 2013 · 4 comments
Closed

Not replace "src" with actual value. #101

rscouto opened this issue Mar 18, 2013 · 4 comments
Assignees
Labels

Comments

@rscouto
Copy link

rscouto commented Mar 18, 2013

Hello tuupola,
I have a problem in my solution, I use Jquery Mobile and Knouckout and I use your plugin for load image of user logged, but when user make logoff I set value of attributte "data-original" for empty, and image "src" for default value, after other user make login the image load is of previous user.

I will hope understand me!

@rscouto
Copy link
Author

rscouto commented Mar 19, 2013

Hi tuupola.
The problem is in lines (115 and 100) of code you use command $self.data, this command use cache in my project changed this command for $self.attr("data-" + settings.data_attribute), and working perfectly. Please can you analyze my solution?
Thanks Big hug!

@DragonI
Copy link

DragonI commented Sep 4, 2013

+1 @rscouto! I had the same problem except for a different use case which was setting the data_attribute to the appropriate image based on srcset values. When resizing the window the original image would be displayed even though the data_attribute had the new image. Now with your fix, it's all good. Well, I had to add trigger("scroll") to get things to work.

@wrouesnel
Copy link

Ok I can confirm that this seems to have fixed a problem I had as well. The exact diff I used with version 1.9.5 to implement this is:

--- /home/will/tmp/jquery.lazyload.js
+++ /home/will/src/eye-fi/eye-fi/client/code/libs/jquery.lazyload.js
@@ -102,7 +102,7 @@
                     }
                     $("<img />")
                         .bind("load", function() {
-                            var original = $self.data(settings.data_attribute);
+                            var original = $self.attr('data-' + settings.data_attribute);
                             $self.hide();
                             if ($self.is("img")) {
                                 $self.attr("src", original);
@@ -124,7 +124,7 @@
                                 settings.load.call(self, elements_left, settings);
                             }
                         })
-                        .attr("src", $self.data(settings.data_attribute));
+                        .attr("src", $self.attr('data-' +settings.data_attribute));
                 }
             });

This seems to fix a recurring issue I've had where with a very large number of images, or when I'm dynamically swapping images in and out, they would sometimes not load.

@tuupola
Copy link
Owner

tuupola commented Nov 16, 2013

Fixed in 1.9.x.

@tuupola tuupola closed this as completed Nov 16, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants