Currently the google static maps https://developers.google.com/maps/documentation/maps-static/overview takes too long to load which causes a high LCP(large content painting).
The solution would be to load a placeholder image and then once the google static maps IMG is finished loading to replace the placeholder with it. What would be a way to implement this?
I did try this but it didn't replace the placeholder and always returned false.
function imgLoaded(imgElement) {
return imgElement.complete && imgElement.naturalHeight !== 0;
}