add loading logic for background images