R
R
Rinat Haisman2018-04-22 13:27:23
JavaScript
Rinat Haisman, 2018-04-22 13:27:23

How to load images on demand (click)?

Good hour.
There is a portfolio on the site, in the portfolio itself - previews are easy, when you click on them, a modal pops up with a full image of the landing page. The problem is that large images are loaded along with all the resources of the site initially, which greatly slows down the initial loading of the site.
How to make images load on demand? That is, a person clicked on the preview and a large image was loaded in the modal window. Thank you.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Proskurin, 2018-04-22
@Rinat_Haisman

You are most likely doing something wrong. This is what the preview should look like.

<a href="fullimage.jpg">
   <img src="thumbimage.jpg">
</a>

This way the browser will not load the image from a href, but only the thumbimage.jpg thumbnail

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question