0
Clicking the Fade button to div some and then clicking the Unfade button the div reappears. So far so good.
If you then click the Fade button again, the div disappears, appears and disappears again.
If you then click the Unfade button, the div appears, disappears and appears again.
If you then click fade again, the div disappears, appears, disappears, appears and disappears again.
So if you click alternately 10 times in Fade and Unfade you will see that the div goes back and forth 10 times. I wonder if there is a way to avoid this. If you click fade disappears and Unfade appears regardless of the number of times you have clicked alternately.
function functionHide() {
$("div").hide(1000);
}
function functionShow() {
$("div").show(1000);
}
$( "#id1" ).click(function() {
$( "body" ).click(functionHide);
});
$( "#id2" ).click(function() {
$( "body" ).click (functionShow);
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<button id="id1">Fade</button>
<button id="id2">UnFade</button>
<div>Click!</div>
It’s a little hard to figure out what you really need. You’ve tried adding an event monitor ?
– Edilson