JSFiddle - React, Tailwind, and code Playground

by andreortigao

HTML

<div class="load-content"></div>
<div class="load-content"></div>
<div class="load-content"></div>

CSS

.load-content {
    border: 1px solid #000 ;
    width:150px;
    height:150px;
    margin:5px;
}

JavaScript

(function($){
    $.fn.loading = function() {
        var modal = $('<div />', {
            position: 'absolute',
            top: 0,
            left:0,
            width:'100%',
            heigth:'100%',
            background:'#000',
            opacity:0.4
        });
        
        $(this).css('position', 'relative').append(modal);
    };
})(jQuery);

$(function(){
    $('.load-content').click(function(){
        $(this).loading();
    });
});