JSFiddle - React, Tailwind, and code Playground
by lollero
HTML
<div class="hilight">sadfad</div><div>!!!!1adsfasdfsdfsafaf</div>
JavaScript
/**
* Simple Image Caption v.2.0 ( SIC 2.0 )
* Author: Joonas Pääkkö
* Website: www.joonas.me/sic
* MIT license:
* http://www.opensource.org/licenses/mit-license.php
*/
(function($) {
$.fn.sic = function( options ) {
return this.each(function() {
var obj = $(this), // Obj is always <img>.
objD = obj.data(), // Looks for data in obj.
o = $.extend( true, {}, $.fn.sic.defaults, options, objD ); // o refers to both options and data.
obj.init = function() {
console.log( 'init' );
obj.events();
objD.next.css({ background: 'red' });
};
obj.events = function() {
console.log( 'events' );
obj.data({'next': obj.next() });
};
obj.init();
});
};
/*
===================
DEFAULT OPTIONS
===================
*/
$.fn.sic.defaults = {
caption: {
background: 'red'
}
};
})(jQuery);
$('.hilight').sic();