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"); }); }); 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"); }); }); 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й клик }); }); 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"} }); }); Source: https://ru.stackoverflow.com/questions/20326/
All Articles