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

133
Views
Call function when resizing window but revert back after event - Javascript

I am trying to make a div id visible only during a resizing event using javascript. I have code written that triggers when I resize the window - but I wish for this to stop triggering and revert back to hidden for the div style after the resize event.

window.addEventListener('resize', animateWindow);

function animateWindow(){
    var x = document.getElementById("resize-text");
    x.style.visibility = "visible";
}

The CSS code is set to this:

#resize-text{
    visibility: hidden;
    width: 100%;
    height: 100%;
    background-color: blueviolet;
}

Should I do an if else statement using an event listener? Or what is the best approach for this?

Many thanks!

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!