JSFiddle - React, Tailwind, and code Playground
by Gwyn Milcote
HTML
retic gene list
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Cabin">
<p>Helpful info sources:
<ul>
<li><a href='https://ball-pythons.net/forums/showthread.php?224687-Morph-Guide-Python-Reticulatus-With-notes-on-locale-size-origination'>Gene list</a></li>
<li><a href='https://www.morphmarket.com/us/c/reptiles/pythons/reticulated-pythons/index'>Morph Market, so many photos to search!</a></li>
</ul>
</p>
<div class='section round' id='locus_a'>
<div class='title' data-locus='a'>Albino (A locus)</div>
<div class='content hidden'>
<div class='images'>
<div class='image'>
<img src='https://morphmarket-media.s3.amazonaws.com/media/cache/58/51/5851272ccd44cc0680b670e82ecc6357.jpg' loading='lazy' alt='description'>
<br>White albino
</div>
<div class='image'>
<img src='https://morphmarket-media.s3.amazonaws.com/media/cache/27/24/27241d6c28a25e4caa0917d7fc6b3c1b.jpg' loading='lazy' alt='description'>
<br>White albino
</div>
<div class='image'>
<img src='https://morphmarket-media.s3.amazonaws.com/media/cache/d0/65/d065809a2d64eb056ffaedb8de3d045b.jpg' loading='lazy' alt='description'>
<br>Purple albino
</div>
<div class='image'>
<img src='https://morphmarket-media.s3.amazonaws.com/media/cache/e4/44/e44468d5db41d1413ff1bbcca31e7b2a.jpg' loading='lazy' alt='description'>
<br>Purple albino
</div>
<div class='image'>
<img src='https://morphmarket-media.s3.amazonaws.com/media/cache/2c/ca/2ccac7efc85b9d11d1dce768d4d166f8.jpg' loading='lazy' alt='description'>
<br>Lavender
</div>
<div class='image'>
<img src='https://morphmarket-media.s3.amazonaws.com/media/cache/af/0c/af0ce295ad7fb61443641fc2074dc9b9.jpg' loading='lazy' alt='description'>
<br>Lavender
</div>
<div class='image'>
<img src='https://morphmarket-media.s3.amazonaws.com/media/cache/bc/f4/bcf484810331e7d7417a206fe6868989.jpg' loading='lazy'...
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;
/*width: 150px;*/
margin: 5px;
}
.section .image img {
height: 150px;
width: auto;
max-width: 250px;
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;
...
JavaScript
$(".section .title").click(function(){
var locus = $(this).data("locus");
$("#locus_" + locus + " .content").toggleClass("hidden");
});