You can use the plugin Lazyload to load the images only when they are in the visible area of the browser screen.
The advantage of this is that there is a performance gain in page loading and also saves internet bandwidth consumption of users, even more when they access your site via 3G or 4G.
Using Lazy Load is simple. Simply add the script to <head>
of your page:
<script language="javascript" src="jquery.lazyload.js"></script>
Then add the class .lazy
on the images that will be affected:
<img class="lazy" data-original="imagem_real.png" src="imagem_pre.png" />
And call the function in the script:
<script>
$(function(){$("img.lazy").lazyload();});
</script>
Notes:
data-original
is the path of the final image, which will be loaded
when the area it is in is within the visible area of the
browser.
- In
src
you put the path of a generic image, which will be
preloaded before final image (create a lighter image
possible, such as a 1x1 pixel png, for example).
Download the plugin and see the documentation in the link
https://appelsiini.net/projects/lazyload/
All HTML already loads separately from images.
– Oralista de Sistemas