JSFiddle - React, Tailwind, and code Playground
HTML
<div id="details">
<div id="child1">child 1</div>
<div id="child2">child 2</div>
<div id="child3">child 3</div>
</div>
<a href="#child1">child 1</a>
<a href="#child2">child 2</a>
<a href="#child3">child 3</a>
JavaScript
var checkcurrent = null;
$(function(){
$('a').click(function(){
detailspage($(this).attr('href'));
});
});
function detailspage(page) {
if (page != checkcurrent) {
var details = $('div#details'); // so we only have to search the dom once
checkcurrent = page;
details.children("div").slideUp("slow").promise().done(
function() {
$('div' + page).slideDown("slow");
});
};
};