Toggle effect for fade – with jQuery

jQuery
Write the below function first:

jQuery.fn.fadeToggle = function(speed, easing, callback) {
return this.animate({opacity: ‘toggle’}, speed, easing, callback);
};

After that you can do as usual like:

$(“.main”).click(function () {
$(“.child”).fadeToggle(“slow”);
});

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.