-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Does imagesLOaded not fire when the src attribute of an img element is changed with javascript? #136
Comments
maybe try wrapping the |
I'm having this issue as well but in my situation I am completely replacing an img tag with a new one containing a different src image using jquerys replaceWith(). Am using imagesLoaded after the replaceWith() call to fire a new "fade-in" effect once the image is loaded. It seems to occur randomly but sometimes imagesLoaded seems to just instantly fire its complete/always message, leading to me getting an incorrect height calculation (0px) on the container w/ the new image. is the setTimeout the way to go? EDIT: I wrapped a setTimeout with a 100ms delay around my imagesLoaded call and everything seems to be working now. Hrmph? |
@skalfyfan do you have a live demo for this bug (a jsbin or jsfiddle) ? |
Actually |
@k-risc The answer to your question, in short: Yes, imagesLoaded does not fire when the src attribute of an img element is changed with javascript, this happens with Firefox. see #121 Until the workaround mentioned in this issue is fully tested, you're probably "safer" by using imagesLoaded only on newly added images element. |
I am using imagesloaded.pkgd.min.js and use the following javascript:
But the function defined in "always()" is triggered immediately each time this code is executed. Thus the overlay is never visible because it gets hidden right after it was shown.
The text was updated successfully, but these errors were encountered: