Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

207
Visualizações
Ajax load causes content to jump

When I am loading in content from another page using Ajax my footer jumps up to below my header before moving back down.

I recon this is caused by $('#container').remove(); which means I am essentially removing the container before loading in the new container.

Is there a way to stop my footer from jumping up and down between Ajax loads?

Here is my JQuery

$('nav a').on('click', function(e) {
   e.preventDefault();
   var url = this.href;
   $('nav a.highlight').removeClass('highlight');
   $(this).addClass('highlight');
   $('#container').remove();
   $('#content').load(url + ' #container').hide().fadeIn(3500);
});

I'v uploaded an example of what is happening to me on a test server here.
I had to upload it as a snippet or pen does not allow more than one HTML page

over 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

Do not remove #container

$('nav a').on('click', function(e) {
  e.preventDefault();
  var url = this.href;

  $('nav a.highlight').removeClass('highlight');
  $(this).addClass('highlight');

  //$('#container').remove();
  $('#content').load(url + ' #container').hide().fadeIn(3500);
});
over 4 years ago · Santiago Trujillo Relatório

0

I'm not perfect but i think this can help you to get an idea. You can set min-height of #content or you can add a class .stick_footer to footer immediately after removing container and remove class .stick_footer after data loaded. sorry for bad english.

.stick_footer{
  position:absolute; bottom:0;left:0;right:0; top:9em;
}
over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda