I made a car dealership page. I store data about cars in an array of objects, then I loop through it to insert data into my HTML file to display on a page. It works fine.
The problem arises when I try to add a lazy load function using intersection observers. The stuff gets put into page correctly but the intersection observer doesn't see the images and doesn't load them.
Here is a link to a codepen https://codepen.io/russiandobby/pen/xxxJvxv?editors=0010 , if you change data-src
to src
it will work.
How can I make it work so I can have lazy-loading.
<img data-src="${car.img}" alt="jag1" class="card-img-top car-img popup-img">