-
-
Notifications
You must be signed in to change notification settings - Fork 269
Update src does not work #85
Comments
Are you using only |
Thanks for the quick response https://jsbin.com/goxazineti/1/edit?html,output
If you dont like cats i could replace the images with dogs,. |
No, I like cats 🙀 |
Any updates on this? I can confirm this issue on Edge. |
Sorry it took so long. Yeah the bug is confirmed, however that is not the only way to change the src. Changing the img.src = "new=image.jpg"; |
@bfred-it thing is I'm using Angular.js and the |
I'm doing a simple lazy-load, setting the src to the real image (from a spacer image) as the user scrolls down and getting this too. Had to manually call objectFitImages(myImages) again. |
Thanks for this solution.
An improvement is to support updating the src attribute. At the moment it does not update the bg image url when the src is updated.
https://github.com/bfred-it/object-fit-images/blob/master/index.js#L118
By swapping the src and the currentSrc fixed it for me.
el.style.backgroundImage = "url(\"" + ((ofi.img.src || ofi.img.currentSrc).replace(/"/g, '\\"')) + "\")";
Though I cant oversee the full effect. #84
Cheers.
The text was updated successfully, but these errors were encountered: