FadeIn/FadeOut Toggle Using One Button

button, jquery

Solution

You can use fadeToggle()

$('.info').click(function() {
    $('h7').fadeToggle(750);
}

Problem

I am currently using this code to try and use a button with a class of `.info` as a toggle for fading in and fading out text. Right now the animation is running back to back with this code. Is there a way where I click the button once and have the text fade in without it fading out seconds later? The same will apply for fading out when you click the button again. ``` $('.info').click(function() { $('h7').fadeIn(750); }); $('.info').click(function() { $('h7').fadeOut(750); }); ```

Original source