Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

188
Vistas
How center a prepend loading div?
<script>
(function($) {
    $(document).on('facetwp-refresh', function() {
        $('.facetwp-template').prepend('<div class="is-loading">Loading...</div>');
    });
    $(document).on('facetwp-loaded', function() {
        $('.facetwp-template .is-loading').remove();
    });
})(jQuery);

</script>

<style>
    .is-loading{
   position: relative;
     width: 100%;
    height:100%;
    align-content:center;
    align-items:center;
    justify-content:center;
    text-align:center;
    font-size:18px;
    font-weight:400;    
    color: white;   
    }   
    
</style>

I have a lot of trouble trying to center my .is-loading div inside .facetwp-template I want it to always be in the center of the content .facetwp-template

if someone can simulate such a situation .facetwp-template can be any div and insert a loading div inside and show me what I missed and didn't understand.

maybe even add an ovelay effect to see the "white" loading text and if you're crazy enough maybe also insert a slightly exotic loading animation like a spinning icon?

what I got enter image description here

what I want enter image description here

about 4 years ago · Juan Pablo Isaza
3 Respuestas
Responde la pregunta

0

Make position absolute and then adjust your div position on the screen. Something like:

<style>
    .is-loading{

   position: absolute;
    top: 50%;
    left: 50%;

    width: 100%;
    height:100%;
    align-content:center;
    align-items:center;
    justify-content:center;
    text-align:center;
    font-size:18px;
    font-weight:400;    
    color: white;   
    }   
    
</style>
about 4 years ago · Juan Pablo Isaza Denunciar

0

You need to give display: flex; or display: inline-flex; to your .is-loading class. Only then you can apply other flex-related attributes to your class. Check this fiddle: https://jsfiddle.net/enginustun/p32zbkwn/2/

You can try following style;

.is-loading {
    display: flex;
    position: relative;
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 400;
    color: white;
  }
about 4 years ago · Juan Pablo Isaza Denunciar

0

Making it absoulte and give top, left 50% to place it center of the screen. Then translate by -50%.

  .is-loading{
    position: absoulte;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height:100%;
    text-align:center;
    font-size:18px;
    font-weight:400;    
    color: white;   
    }
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda