My common problem is lazy loading images. I got to the point that I upload images only when they are on the screen. I need to delete images that do not appear on the screen.
I thought that
$(image).removeAttr("src")
will do this and it will remove src correctly, but will not clear the screen image and will not replace it with what is in alt.
How do I delete an image? Please note: I do not want to remove the img tag (I need it later), just clear the image from the screen.
Another code that may be relevant (although why I don't know) is
updateCarImages:=>
imagesOnScreen = $(@el).find(".carImageClass:onScreen")
imagesOffScreen = _.without(cachedImagesOnScreen,imagesOnScreen)
for image in imagesOnScreen
imgSrc = $(image).attr("src")
if (!imgSrc)
id = $(image).data("tooltip-id")
console.log(id)
result = resultsStore.get(id+"")
console.log(result)
$(image).attr("src", result.get("carImageUrl"))
console.log(imagesOffScreen)
for image in imagesOffScreen
$(image).removeAttr("src")
source
share