JSFiddle - React, Tailwind, and code Playground
by suraj rahel
HTML
<h1> this is the way of testing </h1>
JavaScript
(function ($) {
var methods = {
slideIn: function () {
this.fadeIn().slideDown();
return this;
},
slideOut: function () {
this.fadeOut().slideUp();
return this;
},
init: function () {
// or you can do more functions here
return this;
}
};
$.fn.slides = function (methodOrOptions) {
if (methods[methodOrOptions]) {
return methods[methodOrOptions].apply(this, Array.prototype.slice.call(arguments, 1));
} else if (typeof methodOrOptions === 'object' || !methodOrOptions) {
// Default to "init"
return methods.init.apply(this, arguments);
} else {
$.error('Method ' + methodOrOptions + ' does not exist on jQuery.slides');
}
};
})(jQuery);
$(function () {
$('h1').click(function () {
$(this).slides("slideOut");
});
});