Implement Loader while loading page

1

I would like to better understand a feature commonly used in web systems where you access a page it displays a loader while content is not ready.

How to implement this in a PHP system that does some delivery procedures for the front end that also handles some DOM's?

    
asked by anonymous 27.10.2016 / 16:06

1 answer

0

Boot a <div> with

position: absolute;
top: 0px;
left: 0px;
z-index: 100;

Inside it you put your loader image, just do the style to center it.

It's just logical to make it appear or hide.

Ex:

<div id="meuLoader">...</div>

<script>
    // rolou algum processamento no seu .php ou vc fez um ajax
    $('#meuLoader').addClass('hidden'); // classe do bootstrap que coloca estilo 'display: none';
</script>
    
27.10.2016 / 18:10