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

335
Visualizações
Zoom image button must be clicked twice to work in Angular?

I'm trying to implement a zoom button that uses getElementById to increase the width

<span tslbutton (click)="zoomIn()"> <i class="fa fa-search-plus" aria-hidden="true"></i></span>
zoomIn() {
    if (document.getElementById("left_pane").style.width == "25%") {
      document.getElementById("left_pane").style.width = "47%"
    }
    else if (document.getElementById("left_pane").style.width == "47%") {
      document.getElementById("left_pane").style.width = "100%"
      document.getElementById("left_pane").style.marginRight = "0"
      document.getElementById("left_pane").style.marginLeft = "0"
    } else {
      document.getElementById("left_pane").style.width = "25%"
      document.getElementById("left_pane").style.marginRight = "285px"
      document.getElementById("left_pane").style.marginLeft = "222px"
    }
  }

This code here displays a magnifying glass, then upon clicking it it will increase the size of my left pane on the screen.

Only issue here is that I have to click the magnifying glass image twice in order for it to zoom in. Why is this happening? And is there a way to make it zoom in on the first click? Is there a more elegant way to make this work?

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