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

104
Visualizações
How to show two html output for mobile and website?

I want to have 2 different outputs for mobile and desktop how I must handle it with javascript? for example

first i check the device width if width <= 700 px is mobile = true and show mobile output(html,js,css) else mobile = false is mean device is a desktop and show desktop output (other html,js,css)

how I can do this?

about 4 years ago · Juan Pablo Isaza
3 Respostas
Responde à pergunta

0

you shouldn't use javascript for this work. You should use css media queries. Take a look at this

about 4 years ago · Juan Pablo Isaza Relatório

0

If you must handle it through JavaScript, you can use the window.screen.width and window.screen.height properties to check the devices height and width. But as a Comment already suggested, you might want to look into media-queries in CSS they are pretty powerful.

Possible usage

if(window.screen.width <= 700) {
    // do mobile logic
} else {
    // do desktop logic
}
about 4 years ago · Juan Pablo Isaza Relatório

0

You can use media query to handle what will do by its screen size.

Here is to handle it with JS,

Reference:

  • https://www.w3schools.com/howto/howto_js_media_queries.asp
  • https://css-tricks.com/working-with-javascript-media-queries/

And here is when you want to handle with CSS, you can follow this link

  • https://www.w3schools.com/css/css_rwd_mediaqueries.asp
about 4 years ago · Juan Pablo Isaza 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