JSFiddle - React, Tailwind, and code Playground
HTML
<h1>Title to test</h1>
JavaScript
(function ($) {
$.fn.slides = function(method) {
var methods = {
slideIn: function () {
$(this).fadeIn().slideDown();
},
slideOut: function () {
$(this).fadeOut().slideUp();
}
};
return this.each(function() {
methods[method].call(this);
});
};
})(jQuery);
$('h1').click(function() {
var $self = $(this).slides('slideOut');
setTimeout(function() {
$self.slides('slideIn');
}, 1000);
});