JSFiddle - React, Tailwind, and code Playground
HTML
<ul><li>Test</li></ul>
<button id="go">GO</button>
CSS
ul { background-color: 'yellow' }
JavaScript
(function($) {
var settings = {
methods: {
init: function(options) {
options = $.extend(true, {}, settings, options);
console.log('init:', options);
},
show: function() {
console.log('show:', this.options);
},
hide: function( ) {
console.log('hide:', this.options);
}
}
};
$.fn.spinner = function(options) {
if( methods[options] ) {
return methods[options].apply(this, Array.prototype.slice.call(arguments, 1));
}
else if( typeof options === 'object' || !options ) {
return methods.init.apply(this, arguments);
}
else {
$.error('Method ' + options + ' does not exist on jQuery.spinner');
}
};
})(jQuery);
$(document).ready(function() {
$('ul').spinner();
});