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

216
Views
Is there a way to add transition effect (smooth/ease) in js without adding a class?

Si I have a simple few lines of code, basically what it does is when you click on the div that has the id, it disappear (display :none). Normally I would do an addClass / removeClass but I was wondering if just with this code I could add an effect that doesn't make the div brutally disappear but maybe with a transition to the left or the top with 0.8 seconds. How would you proceed?

window.onload = function(){
    var divToHide = document.getElementById('divToHide');
    document.onclick = function(e){
        divToHide.style.display = 'none';
      }
  };
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

If you want to use jquery, you can use slide methods of the same. Constraint is that you will have to use jquery.

$("#divToHide").slideDown(2000); //2000 is the ms for the effect

However you can also apply transition-timing-function in css. If you keep the transition-timing-function: linear and go from width 100% to zero width, it will have the effect of sliding and from to to bottom, transition on height.. https://developer.mozilla.org/en-US/docs/Web/CSS/transition-timing-function

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!