JSFiddle - React, Tailwind, and code Playground

HTML

<div class="section" style="display: none;">section</div>

JavaScript

//sections.push($('#section' + p_sectionIndex));
sections = $.map($(".section"),function(obj){
    return $(obj);
});

this.showSection = function() {
    $(this).show();
}
this.hideSection = function() {
    $(this).hide();
}
sections[sections.length-1].on('show',this.showSection);
sections[sections.length-1].on('hide',this.hideSection);


sections[sections.length-1].trigger("show");
setTimeout(function(){
    sections[sections.length-1].trigger("hide");
},2000)