JSFiddle - React, Tailwind, and code Playground
by Maulik Anand
HTML
<a class="viewSchedule" target="1"><span class="viewBTN">WEEKLY</span></a>
<a class="viewSchedule" target="2"><span class="viewBTN">DAILY</span></a>
<a class="viewSchedule" target="3"><span class="viewBTN">LIST</span></a>
<br /><br /><br /><br />
<div id="sh-week" class="targetSched first">WEEKLY CONTENT</div>
<div id="sh-daily" class="targetSched">DAILY CONTENT</div>
<div id="sh-list" class="targetSched">LIST CONTENT</div>
CSS
.viewSchedule {}
.viewBTN {display:block;width:auto;height:auto;padding:5px 10px 5px 10px;background:#ccc;color:#242424;cursor:pointer;border-radius:5px;float:left;margin-left:10px;font-family:dina,Arial, Helvetica, sans-serif;font-size:16px;text-align:center;}
.viewBTN:hover {background:#FFF;color:#333;}
.viewSchedule.active .viewBTN{
background-color:red;
color:white;
}
.targetSched {display: none}
.targetSched.first {display: block}
JavaScript
jQuery('.viewSchedule').click(function () {
var index = $(this).index(),
newTarget = jQuery('.targetSched').eq(index);
$(".viewSchedule.active").removeClass("active");
$(this).addClass("active");
console.log(index+newTarget)
jQuery('.targetSched').not(newTarget).fadeOut('fast')
newTarget.delay('fast').fadeIn('fast')
return false;
})