How to make, that after the next click on an element that that after the first appeared, disappeared?

$(document).ready(function(){ $("#box").click(function () { $("#gor").fadeIn([200],"slow"); }); }); 
  • 2
    And what is the difficulty? Show that it does not work and we will help, and write from scratch, and even to such a terribly decorated question - hardly anyone will! - metazet
  • i'm not sure js and jquery - iwowa
  • 3
    So this is not a portal to help drowning people; if you don’t know how - learn what doesn’t work - we will help. No one will solve your problems for you. - metazet

2 answers 2

There is such a good function in jQuery: toggle (). This is how it will work:

 $(document).ready(function(){ $("#box").toggle(function () { $("#gor").fadeIn([200],"slow");//1й клик }, funciont(){ $("#gor").fadeIn([600],"slow");//2й клик }); }); 
  • 2nd click - you will write the necessary action yourself, I just copied to show the essence. - metazet

You can still use the check.

 $(document).ready(function(){ $("#box").click(function () { var gor = $("#gor"); if(gor.css('display')=='none'){gor.fadeIn([200],"slow");} else{gor.fadeOut([200],"slow"} }); });