Skip to content

Instantly share code, notes, and snippets.

@tylershuster
Last active August 29, 2015 14:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tylershuster/e48f040a3c6d42cf15e1 to your computer and use it in GitHub Desktop.
Save tylershuster/e48f040a3c6d42cf15e1 to your computer and use it in GitHub Desktop.
jQuery.fn.extend({
cvToggle: function( duration , easing ) {
easing = typeof easing !== 'undefined' ? easing : 'swing';
if( this.css('opacity') == '0' ) {
this.slideToggle({
duration: 'fast',
easing: easing,
complete: function(){
jQuery(this).animate({
opacity: 1
}, duration);
}
});
} else {
this.animate({
opacity: 0,
}, duration, function(){
jQuery(this).slideToggle({ duration: 'fast', easing: easing });
});
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment