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

285
Views
hide/show class add in the children div based on screen resolution and screen resized

I have a table with nth number of columns. I want to hide particular column when total column width exceed with screen width.

below is design enter image description here

below is code

 let tableHeaderColumnList = $(".table-header__row")
  .children();

$(window).resize(function () {
  let screenWidth = window.innerWidth;
  let totalColumnWidth = 0;
  console.log(screenWidth);
  setTimeout(() => {
    for (let i = 0; i < tableHeaderColumnList.length; i++) {
      totalColumnWidth += tableHeaderColumnList[i].offsetWidth;
      if (screenWidth < totalColumnWidth) {
        $(tableHeaderColumnList[i]).addClass("hide-cell");
      } else {
        $(tableHeaderColumnList[i]).removeClass("hide-cell");
      }
    }
  }, 1000);
});

above code is not working properly

about 4 years ago · Juan Pablo Isaza
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!