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

229
Visualizações
mediaMatch not working when resizing window

I am trying to add a javascript to check the width of the window and produce a different styling depending on if above or below a specific media breakpoint. All seems to work as expected however when I transition between the two breakpoints it breaks and I can see in the dev tools that the styling doesn't update. If I then refresh all looks right again.

Sample Code:

if (window.matchMedia("(min-width: 768px)").matches) {
  this.$obj.show().delay(200).animate({'bottom': '0'}, 1000);
} else {
  this.$obj.show().delay(200).animate({'top': '0'}, 1000);
}

How can I make this work when expanding and contracting the window as opposed to just on initial page load?

about 4 years ago · Juan Pablo Isaza
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