Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
jQuery Plugin to fade in and out with a vertical slide
(function ($) {
'use strict';
var getUnqueuedOpts = function (opts) {
return {
queue: false,
duration: opts.duration,
easing: opts.easing
};
};
$.fn.showDown = function (opts) {
opts = opts || {};
$(this).hide().slideDown(opts).animate({ opacity: 1 }, getUnqueuedOpts(opts));
};
$.fn.hideUp = function (opts) {
opts = opts || {};
$(this).show().slideUp(opts).animate({ opacity: 0 }, getUnqueuedOpts(opts));
};
$.fn.verticalFade = function (opts) {
opts = opts || {};
if ($(this).is(':visible')) {
$(this).hideUp(opts);
} else {
$(this).showDown(opts);
}
};
}(jQuery));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment