JSFiddle - React, Tailwind, and code Playground

by Gwyn Milcote

HTML

horse gene list
<link rel="stylesheet"  href="https://fonts.googleapis.com/css?family=Cabin">

<div class='section round' id='locus_e'>
    <div class='title' data-locus='e'>Extension (E locus)</div>
    <div class='content hidden'>
    <div class='images'>
	    
        <div class='image'>
		    <img src='https://c2.staticflickr.com/4/3655/3569331589_3694ab0c51.jpg' loading='lazy' alt='description'>
			<br>Black (E+/E+ or E+/e)
		</div>
        <div class='image'>
		    <img src='http://1.bp.blogspot.com/-l5IdqT_zpfI/VCG4ZOtefTI/AAAAAAAAB6E/PTiJHwxEg0g/s1600/CHESTNUT_hannoveraner_bob711250_LR.jpg' loading='lazy' alt='description'>
			<br>No black (e/e)
		</div>
		
	</div>
    <p>The extension locus controls the production of black pigment (eumelanin). A recessive mutation here can cause production to stop. This mutation is sometimes called <b>recessive red</b>. It always results in a chestnut horse, with no black anywhere on the body.</p>
	<div class='alleles round'>
	
	    <div class='allele round hoverable'>
		    E+
		    <div class='hoverbox'>
			Dominant wildtype. Allows black pigment production.
			</div>
		</div>
         > 
		<div class='allele round hoverable'>
		    e
		    <div class='hoverbox'>
			Recessive mutation. Black pigment is switched off.
			</div>
		</div>
		
	</div>
    <p><b>Inheritance:</b> red is a recessive mutation, meaning the horse needs to inherit 2 copies (one from each parent) to express it.</p>
    </div>
</div>

<div class='section round' id='locus_a'>
    <div class='title' data-locus='a'>Agouti (A locus)</div>
    <div class='content hidden'>
	<div class='images'>
	    
		<div class='image'>
		    <img src='https://straightfromthehorsesmouth2you.files.wordpress.com/2011/10/bay-horse-2.jpg' loading='lazy' alt='description'>
			<br>Bay
		</div>
		<div class='image'>
		    <img src='https://tse1.mm.bing.net/th?id=OIP.HscMa-Nxuxajr0BBVYBWFwHaGL&pid=Api' loading='lazy' alt='description'>
			<br>Bay
		</div>
		<div...

CSS

img, div, button {
    box-sizing: border-box;
}

html, body {
    color: rgba(0, 0, 0, 0.7);
    font-family: 'Cabin', sans-serif;
}

.hidden, .hoverbox {
	display: none;
}

.round {
    border-radius: 5px;
    background-clip: padding-box;
}

.flex {
    display: flex;
    flex-flow: row wrap;
}
.between {
    justify-content: space-between;
}


.section {
	margin: 10px auto;
	box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.5);
	background-color: #fff;
    overflow: hidden;
}

.section .title {
	font-size: 25px;
    padding: 15px;
    cursor: pointer;
}

.section .content {
    padding: 15px;
}

.section .alleles {
	padding: 10px;
    min-width: 30%; /* Up to 3 loci in a line */
	display: flex;
	justify-content: center;
    align-items: center;
	background-color: #fff;
	font-size: 20px;
}

.section .alleles .allele {
	padding: 10px;
    background-color: rgba(255, 255, 255, 0.2);
	margin: 0px 10px;
	cursor: pointer;
	transition: 0.3s;
}

.section .alleles .allele:hover {
	background-color: rgba(255, 255, 255, 0.4);
	transition: 0.3s;
}

.section .images {
	margin: 10px auto;
	display: flex;
    flex-flow: row wrap;
	justify-content: space-evenly;
}

.section .image {
	text-align: center;
    margin: 5px;
}

.section .image img {
	height: 150px;
    width: auto;
	max-width: 350px;
    border-radius: 5px;
}

#locus_choc .title, #locus_choc .alleles {
    background-color: #996759;
    background-image: linear-gradient(to right, #7A5136, #A87B5C);
}
#locus_di .title, #locus_di .alleles {
    background-color: #EBD19F;
    background-image: linear-gradient(to right, #E6C283, #FAE7C5);
}
#locus_bl .title, #locus_bl .alleles {
    background-color: #9EA5B8;
    background-image: linear-gradient(to right, #717282, #C5C6D4);
}
#locus_mh .title, #locus_mh .alleles {
    background-color: #CF614B;
    background-image: linear-gradient(to right, #963B1C, #E3744F);
}
#locus_lav .title, #locus_lav .alleles {
    background-color: #E0D8E8;
    background-image:...

JavaScript

$(".section .title").click(function(){
    var locus = $(this).data("locus");
    $("#locus_" + locus + " .content").toggleClass("hidden");
});