Why aren't you using loading="lazy" in the markup with hooking the load event on the images? If you set the blurry image as the background-image and the full image as the src, you could probably ditch "unsplash", and around two thirds your scripting too.
See my own lazy loading article: