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

185
Visualizações
how to check my created item y coordinate against my wrapper height?

What I am trying to do: Create item within my wrapper

What is actually happening: Created item can go beyond my wrapper

This is my wrapper code

 <div className="DetailLocationContainer">
       
 </div>

my css

.DetailLocationContainer {
  background-color: red;
  width: 100px;
  height: 300px;
  /* margin: 2% auto auto auto; */
  background-image: repeating-linear-gradient(#ccc 0 1px, transparent 1px 100%),
    repeating-linear-gradient(90deg, #ccc 0 1px, transparent 1px 100%);
  background-size: 50px 50px;
}

This is my create item code

 createElement(el) {
    const i = el.add ? "+" : el.i;
    var test = document.getElementById("hello");
    if (test != null) {
      //  test.getAttribute("style")

      var testing = test.style.transform.replace(/[\(\)]/g, "").split(",")[1];
      console.log("testing ", testing);

      if (testing === "300px") {
        alert("it works");
      }
    }
    return <div key={i} data-grid={el} id="hello"></div>;
  }

even when the created element exceed the height of my wrapper, it did not enter my if condition

This is my codesandbox

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

0

the easy solution would be to add overflow: hidden; to DetailLocationContainer This would hide the overflowing content, but it would still "overflow." You could try to read the sum of the parent divs x coordinate and height, to compare with your child div. But in my opinion that wouldn't result in a cleaner solution.

(i'm not familiar enough with react, to know how you would get access, to your parent div in your js)

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