Preload sencillo con CSS y Javascript

Creación de preload sencillo con CSS y Javascript

HTML
<div class="preload">
	<img src="https://phpres.net/img/loader.gif">
</div>
CSS
.preload {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    background: #f3edef;
}
.preload img {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: auto;
}
JS and NoJS
<script>
$(window).on("load", function() {
	$('.preload').fadeOut('fast');
});
</script>

<noscript>
	<style>
		.preload {
			display: none !important;
		}
	</style>
</noscript>

Editado
0
Puntos
2764
Visitas
0
Resp
Por alber hace 6 años
Admin
Para comentar Inicia sesión o Regístrate
Phpres 2025@ All rights reserved.
Utilizamos cookies para mejorar la navegación en el sitio. Más información Aceptar