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

190
Visualizações
How to keep wrapper remain centered when zooming?

I'm trying to zoom in using the input slider, and I want when content overflows the scrollbar to appear and also position the content to stay centered.

import { useState } from "react";

export default function App() {
  const [scale, setScale] = useState(0.3);

  const updateScale = (e) => {
    setScale(parseFloat(e.target.value));
  };

  return (
    <div style={{
      background:"#DE5833",
      width:"100%",
      height:"100vh"
    }}>
      <div
        style={{
          position: "absolute",
          zIndex: 50
        }}
      >
        <input
          type="range"
          min="0.1"
          max="1.5"
          step="0.01"
          value={scale}
          onChange={updateScale}
        />
      </div>
      <div style={{
        background:"#DE5833",
        width:"100%",
        height:"100%",
        display:"flex",
        justifyContent:"center",
        alignItems : "center",
        transform: `scale(${scale})`,
      }}>
        <div
          style={{
            width: 600,
            height: 600,
            background:"#2563EB"
          }}
        >
        </div>
      </div>
    </div>
  );
}

This is the example of what behaviour I want to achieve https://res.cloudinary.com/dv8aesvfs/video/upload/v1630150060/screen-capture_dernvs.mkv

I can center the content , but i can't sroll to the top or to the left like this : https://res.cloudinary.com/dv8aesvfs/video/upload/v1630150115/screen-capture_1_aas9k8.mkv

you can try it here : codesandbox

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