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

526
Visualizações
Control browser zoom with javascript buttons

Hi I've seen a few ways to control the size of text with JavaScript but I always find the best way to zoom in and out is when I use ctrl - cmd & +/- on responsive layouts.

I quite like how my mobile / tablet layout looks in a browser zoomed in. Is there a way to use JavaScript buttons to actually control the web browser's zoom functionality. So the click of a plus button would have the same effect as ctrl - cmd & +? Rather than mimic the functionality I want it to actually control the browsers zoom functionality.

I've played about with this css and I could use Javascript to increase and decrease the level:

body {
   -moz-transform: scale(2);
   zoom: 2;
   zoom: 200%;
}

but while this does zoom in it also gives horizontal scroll bars and therefore never shows tablet or mobile layouts that I have created.

Is there a way to do it in Javascript? I need it to be cross browser, available to the public and not involve any dev tools.

Thanks

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

0

What about responsive layout in chrome dev tools? https://developer.chrome.com/docs/devtools/device-mode/

Then change it to mobile or tablet device then you can zoom in by using:

document.body.style.zoom = "100%";
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