Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

341
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda