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

188
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
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