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

166
Vistas
How to prevent one child element from scaling

How to prevent scaling #chart while scaling .container?

I want to scale all content (.container) except one div (#chart) while the user resizes the browser window. To this div, I have imported a chart from apexcharts.js and it isn't working properly because of scaling this element. So I want to omit to scale this particular div to fit in all the free space (it is a responsive chart). I have no idea how to do this...

window.addEventListener('resize', () => resizeWindow());

const resizeWindow = () => {
   const {innerWidth: width, innerHeight: height} = window;
  
   if(width < 768) {
      const scale = height/PANEL_HEIGHT;
      document.documentElement.style.setProperty(SCALE_PROPERTY, scale);

      return;
   }
   else {
   const scale = Math.min(width/PANEL_WIDTH, height/PANEL_HEIGHT);
   document.documentElement.style.setProperty(SCALE_PROPERTY, scale);
   }
}
:root {
   --scale-value: 1;
}
.panel {
   height: 1000px;
   width: 1600px;
   position: absolute;
   transform: scale(calc(var(--scale-value) * 0.9));
   transform-origin: center;
}
<div class="container">
  <div id="chart"></div>
</div>

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