Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to slowly show-hide with jquery prop

When I click the button, I want to hide that button and show the div. I want this to be slow.For this:

$('#add_note').on('click',function (){
        $(this).hide(200);
        $('#add_note_form').show(200);
    })

i used this.
But, I want to make this using prop('hidden',true/false).

$('#add_note').on('click',function (){
        $(this).prop('hidden',true);
        $('#add_note_form').prop('hidden',false);
    })

It works like this but is it possible to do it slow?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

You can’t animate a slow transition using the boolean hidden property.

However you can use fadeOut() instead, then set the property in the callback when the animation completes:

$('#add_note').on('click',function() {
  $(this).fadeOut(1000, function() {
    $(this).prop('hidden', true);
  });

  $('#add_note_form').fadeIn(1000);
})
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading