JSFiddle - React, Tailwind, and code Playground
by Dhanck
HTML
<link href="https://fonts.googleapis.com/css?family=Lato" rel="stylesheet">
<div class="tile">
<div class="top-tile">
<span class="top-tile-b1"><img src="https://cdn3.iconfinder.com/data/icons/yumminky-farm-glyph/100/yumminky-farm-09-512.png"> </span>
<span class="top-tile-b2"><img src="https://cdn3.iconfinder.com/data/icons/yumminky-farm-glyph/100/yumminky-farm-09-512.png"></span>
<span class="top-tile-b3"> <img src="https://cdn3.iconfinder.com/data/icons/yumminky-farm-glyph/100/yumminky-farm-09-512.png"></span>
<span class="top-tile-b4"><img src="https://cdn3.iconfinder.com/data/icons/yumminky-farm-glyph/100/yumminky-farm-09-512.png"></span>
<span class="top-tile-b5"><img src="https://cdn3.iconfinder.com/data/icons/yumminky-farm-glyph/100/yumminky-farm-09-512.png"></span>
<img src="https://images.unsplash.com/photo-1553262373-c8dcc1b24b91?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=2134&q=80" class="thumb">
</div>
<div class="bottom-tile">
<span class="bottom-tile-r1"><svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="star" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512" class="svg-inline--fa fa-star fa-w-18 fa-2x"><path fill="currentColor" d="M259.3 17.8L194 150.2 47.9 171.5c-26.2 3.8-36.7 36.1-17.7 54.6l105.7 103-25 145.5c-4.5 26.3 23.2 46 46.4 33.7L288 439.6l130.7 68.7c23.2 12.2 50.9-7.4 46.4-33.7l-25-145.5 105.7-103c19-18.5 8.5-50.8-17.7-54.6L382 150.2 316.7 17.8c-11.7-23.6-45.6-23.9-57.4 0z" class=""></path></svg><span class="tile-title"><span class="">Your score is </span><span class="show">0</span></span></span>
<span class="bottom-tile-r2-r3">
<span class="bottom-tile-r2">22 March 2019</span>
<span class="bottom-tile-r3 type-pdf"><span class="pull-right">PDF <svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="file-pdf" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512" class="svg-inline--fa fa-file-pdf fa-w-12...
CSS
*{
margin:0;
padding:0;
font-family: 'Lato', sans-serif;
}
.tile {
display: block;
position: relative;
width: 230px;
height: 270px;
overflow: hidden;
border: 1px solid #cccccc;
margin: 25%;
-webkit-transition: width 0.2s;
/* For Safari 3.1 to 6.0 */
transition: width 0.2s;
float: left;
-webkit-box-shadow: 0px 0px 15px 0px rgba(0, 0, 0, 0.3);
-moz-box-shadow: 0px 0px 15px 0px rgba(0, 0, 0, 0.3);
box-shadow: 0px 0px 15px 0px rgba(0, 0, 0, 0.3);
transform: scale(2);
}
.tile img {
position: relative;
top: 0%;
left: 50%;
height: 50%;
-webkit-transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
transform: translate(-50%, 0%);
}
.tile .thumb {
position: relative;
top: 0%;
left: 50%;
width: 480px;
-webkit-transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
transform: translate(-50%, 0%);
}
.bottom-tile {
background: #f7f7f7;
height: 56px;
position: absolute;
bottom: 0;
width: calc(100% - 16px);
padding: 6px 8px;
}
.top-tile span:nth-child(-n + 2) {
position: absolute;
z-index: 3;
width: 40px;
height: 40px;
left: 5px;
top: 65px;
color: #fff;
line-height: 40px;
border: 1px solid #454545;
-webkit-transition: width 0.2s;
transition: width 0.2s;
}
.top-tile span:nth-child(n + 3) {
margin-right: -100px;
position: absolute;
z-index: 1;
width: 32px;
height: 32px;
right: 5px;
background: #454545;
color: #fff;
line-height: 30px;
top: 50px;
}
.top-tile-b3 i,
.top-tile-b4 i,
.top-tile-b5 i,
.top-tile-b6 i {
padding-right: 8px;
}
.top-tile span:nth-child(n + 3) {
margin-right: 0;
position: absolute;
z-index: 1;
width: 32px;
height: 32px;
right: 5px;
background: #454545;
color: #fff;
line-height: 30px;
top: 50px;
}
.top-tile-b1 {
background: #03aeee;
}
.top-tile-b2 {
margin-top: 48px;
background: #3cb888;
}
.top-tile-b4 {
margin-top: 40px;
}
.top-tile-b5 {
margin-top: 80px;
}
.type-pdf {
...
JavaScript
function moleUp(){
var tileToMove = 'top-tile-b'+ Math.floor(Math.random() * 5 | 1) ;
$('.'+tileToMove).toggle();
//$('.show').html(tileToMove);
}
window.setInterval(function(){
moleUp()
}, 500);
i = 0;
$('.top-tile-b1, .top-tile-b2, .top-tile-b3, .top-tile-b4, .top-tile-b5').on('click', function(){
$('.show').text(i++);
$(this).hide();
})