V
V
Vyacheslav Yashnikov2018-03-28 21:52:21
JavaScript
Vyacheslav Yashnikov, 2018-03-28 21:52:21

How to make a preloader on the site in%?

Greetings!
Maybe someone made a preloader on the site that really displays the percentage of loading of the entire site? and not just worth a delay of a few seconds after loading all the js.
There is an idea to measure how long it takes to download one file from the server and then, based on this, calculate the time of the animation itself, but in my opinion this is still a crutch ...

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Aleksey Solovyev, 2018-03-28
@alsolovyev

demonstration of mockups, a lot of images that are very high resolution for retina

Load images with js (lazy load). Let the whole page be 10%, then each picture uploaded will be 90% / n-image. So update the status after each picture.
But initially the approach is somehow strange. Are you making the client wait for all the pictures to load ? Why not use lazy load? Under each picture, pre-loader and as the page loads, change the pre-loader to an image. Have the client look at 1 while the others are loaded.
Well, if it's absolutely 'correct', then make an adequate preview-picture (small size). If he likes it, he will go to the page with a full-size picture

M
Maxim Timofeev, 2018-03-28
@webinar

Maybe someone did

I have not met and it is unlikely that there can be a full-fledged solution even in theory
Files come in different sizes, can be stored on different servers, can be loaded from the browser cache, so the download speed of 1 file will not tell you anything.
Let's add here asynchronously loaded resources, time for js scripts to fire, etc. As a result, the logic that tracks all this will slow down the site more than anything else.
Many thought about this and always the right way out is to emulate the progress of the download, and not its exact definition.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question