Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

181
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!