JSFiddle - React, Tailwind, and code Playground
by Carlo Carels
HTML
<h2>Sound 1</h2>
<div class="play" id="a">play</div>
<h2>Sound 2</h2>
<div class="play" id="b">play</div>
<h2>Sound 3</h2>
<div class="play" id="c">play</div>
<!-- SOUNDS -->
<audio id="sound1">
<source src="http://www.bigsoundbank.com/sounds/ogg/0595.ogg" type="audio/ogg" />
</audio>
<audio id="sound2">
<source src="http://www.bigsoundbank.com/sounds/ogg/0580.ogg" type="audio/ogg" />
</audio>
<audio id="sound3">
<source src="http://www.bigsoundbank.com/sounds/ogg/0003.ogg" type="audio/ogg" />
</audio>
CSS
body {font-family:helvetica;}
div.play {
color: #ddd;
width: 50px;
height: 50px;
text-align: center;
line-height: 50px;
font-size: 14px;
cursor: pointer;
position: relative;
background-color: #3498db;
-webkit-border-radius: 50%;
-moz-border-radius: 50%;
border-radius: 50%;
-webkit-box-shadow: inset 0 0 0 1px #ddd, inset 0 0 0 3px #fff,inset 0 0 0 4px #ddd;
box-shadow: inset 0 0 0 1px #ddd, inset 0 0 0 3px #fff,inset 0 0 0 4px #ddd;
-webkit-transition: all .2s ease;
transition: all .2s ease;
}
div.play:hover,
div.play.active {
-webkit-box-shadow: inset 0 0 0 0 #CD391F, inset 0 0 0 0 #fff,inset 0 0 0 0px #cd3920;
-moz-box-shadow: inset 0 0 0 0 #CD391F, inset 0 0 0 0 #fff,inset 0 0 0 0px #cd3920;
box-shadow: inset 0 0 0 0 #CD391F, inset 0 0 0 0 #fff,inset 0 0 0 0px #cd3920;
color: #fff;
background-color: #CD391F;
}
JavaScript
$('.play').click(function(){
var $this = $(this);
$this.toggleClass('active');
if($this.hasClass('active')){
$this.text('pause');
} else {
$this.text('play');
}
});