JSFiddle - React, Tailwind, and code Playground
by Michael Griffin
HTML
<div class="main-row flex items-center">
<div class="col-50-left">
<img src="img/business-cards.png" alt="">
</div>
<div class="col-50-right">
<div class="text-container">
<h2>My new job as a</h2>
<h1>Brand Stylist</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Iste quidem rem dolores facere magni. Recusandae consequatur voluptatibus dolorum sapiente, voluptates, nostrum a amet fuga sint nihil consectetur quod magni dolores.</p>
<div class="thumbs-container items-center">
<img href="http://wpmedia.o.canada.com/2014/04/482002141.jpg" class="thumb-image lightbox-trigger" src="http://wpmedia.o.canada.com/2014/04/482002141.jpg" alt="">
<img href="img/large-02.jpg" class="thumb-image lightbox-trigger" src="img/card-thumb.jpg" alt="">
<img href="img/large-03.jpg" class="thumb-image lightbox-trigger" src="img/card-thumb.jpg" alt="">
<img href="img/large-04.jpg" class="thumb-image lightbox-trigger" src="img/card-thumb.jpg" alt="">
</div><!--thumb-container-->
</div><!--text-container-->
</div><!--col-right-->
</div><!--main-row-->
CSS
body {
margin: 0px;
padding: 0px;
font-family: "Open Sans", sans-serif;
}
/*-----FLEX STYLES----- */
.flex {
display: flex;
flex-direction: row;
}
.items-center {
align-items: center;
}
/*-----MAIN STYLES----- */
.main-row {
min-height: 100vh;
width: 100%;
}
.col-50-left {
width: 50%;
height: 549px;
}
.col-50-left img {
margin-left: -200px;
transition: all 400ms ease-in-out;
}
.col-50-left img:hover {
margin-left: 0px;
}
.col-50-right {
width: 50%;
}
.col-50-right h2 {
margin: 0;
padding: 0;
color: #97c701;
text-transform: uppercase;
letter-spacing: 2.3px;
font-weight: 300;
font-size: 17px;
color: #532856;
}
.col-50-right h1 {
width: 100%;
margin: -10px 0 0 -4px;
padding: 0;
color: #97c701;
text-transform: uppercase;
font-weight: 800;
font-size: 50px;
}
.col-50-right p {
color: #333333;
font-weight: 300;
font-size: 16px;
margin: 0;
padding: 0;
width: 90%;
}
.text-container {
width: 90%;
}
.thumbs-container {
margin-top: 15px;
}
.thumb-image {
width: 20%;
padding: 5px;
position: relative;
overflow: hidden;
-webkit-transition: all 0.45s ease-in-out;
}
.thumb-image:hover {
-webkit-transform: scale(1.1);
}
#lightbox {
justify-content: center;
position: absolute;
z-index: 10;
width: 100%;
height: 100%;
top: 0;
left: 0;
right: 0;
bottom: 0;
color: white;
background-color: rgba(0, 0, 0, 0.8);
}
.content {
position: relative;
width: 60%;
height: auto;
}
.content img {
width: 100%;
height: auto;
}
.close {
position: absolute;
margin: 0;
padding: 0;
top: -22px;
right: -15px;
color: red;
font-weight: 800;
font-size: 40px;
}
JavaScript
$(document).ready(function(){
$('.lightbox-trigger').on('click',function(e){
e.preventDefault();
var image_href = $(this).attr("href");
if($('#lightbox').length > 0) {
$('#contant').html('<img src="' + image_href + '"/>');
$('#lightbox').show();
}
else {
var lightbox =
'<div id="lightbox" class="flex items-center">' +
'<div class="content">' +
'<p class="close">X</p>' +
'<img src="' + image_href + '" />' +
'</div>' +
'</div>';
$('body').append(lightbox);}
});
$('#lightbox').on('click', function(){
$('#lightbox').hide();
});
});