<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/js/bootstrap.min.js"></script>
<script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
<!------ Include the above in your HEAD tag ---------->
<div class="container">
<h2 class="text-center">Portofolio</h2>
<div class="gallery">
<ul>
<li><img src="http://placehold.it/300/f1b702/fff&text=image1" alt="Lorem ipsum dolor sit amet, consectetur adipisicing elit. Reprehenderit, quae, quam. Ut dolorum quia, unde dicta at harum porro officia obcaecati ipsam deserunt fugit dolore delectus quam, maxime nisi quo."></li>
<li><img src="http://placehold.it/300/d2f1b2/222&text=image2" alt="Lorem ipsum dolor sit amet, consectetur adipisicing elit. Maxime accusamus officiis dignissimos doloribus consectetur harum eos sapiente optio aut minima."></li>
<li><img src="http://placehold.it/300/eee/000&text=image3" alt="Lorem ipsum dolor sit amet, consectetur adipisicing elit. Voluptates veritatis similique, amet, maiores soluta recusandae cupiditate, sed perspiciatis fugit minima, sunt dolores cum earum deserunt illo ipsum!"></li>
<li><img src="http://placehold.it/300/222/fff&text=image4" alt="Lorem ipsum dolor sit amet, consectetur adipisicing elit. Itaque laudantium dignissimos tenetur eos unde quidem repellat officiis nemo laboriosam necessitatibus deleniti commodi quis aliquid est atque tempora aut, nihil!"></li>
<li><img src="http://placehold.it/300/b47f99/000&text=image5" alt="Lorem ipsum dolor sit amet, consectetur adipisicing elit. Architecto minus consequatur soluta quaerat itaque, laboriosam quis a facilis, cumque, deleniti quas aperiam voluptate dolore. Enim nostrum sit eaque, porro eligendi illo placeat?"></li>
<li><img src="http://placehold.it/300/e1d400/000&text=image6" alt="Lorem ipsum dolor sit amet, consectetur adipisicing elit. Sequi suscipit quam, id aliquam totam aperiam quas rem debitis voluptatem pariatur, illo accusamus facilis eius ipsa! Reprehenderit libero, quas iste repudiandae distinctio, quos dignissimos."></li>
</ul>
</div>
</div>
body{
background-color: #4e5d6a;
font-family: "Open Sans", sans-serif;
}
.container{
max-width: 640px;
margin: 5% auto;
padding: 20px;
background-color: #fff;
border-radius: 10px;
overflow: hidden;
box-sizing: border-box;
box-shadow: 0 0 5px #222;
}
.text-center{
text-align: center;
margin-bottom: 1em;
}
.gallery ul{
list-style: none;
padding: 0;
}
.gallery li{
display: inline-block;
float: left;
width: 28.3333%;
margin: 2.5%;
position: relative;
font-size: 0;
transition: .25s box-shadow ease-in-out .1s;
}
@media only screen and (max-width: 680px) {
.gallery li {
width: 45%;
}
.lightbox img {
margin-top: 5%;
}
}
@media only screen and (max-width: 480px) {
.gallery li {
width: 100%;
margin: 2% 0;
}
}
.gallery li:hover{
box-shadow: 0 0 15px #4e5d6a;
}
.gallery img{
width: 100%;
}
/*Lighbox CSS*/
.lightbox{
display: none;
width: 100%;
height: 100%;
background-color: rgba(0,0,0,.7);
position: fixed;
top: 0;
left: 0;
z-index: 20;
padding-top: 30px;
box-sizing: border-box;
}
.lightbox img{
max-width: 80%;
margin-right: auto;
margin-left: auto;
display: block;
}
.lightbox .caption{
margin: 15px auto;
width: 50%;
text-align: center;
font-size: 1em;
line-height: 1.5;
font-weight: 700;
color: #eee;
}
// Create a lightbox
var $lightbox = $("<div class='lightbox'></div>");
var $img = $("<img>");
var $caption = $("<p class='caption'></p>");
// Add image and caption to lightbox
$lightbox
.append($img)
.append($caption);
// Add lighbox to document
$('body').append($lightbox);
$('.gallery li').click(function (e) {
e.preventDefault();
// Get image link and description
var src = $(this).children('img').attr("src");
var cap = $(this).children('img').attr("alt");
// Add data to lighbox
$img.attr('src',src);
$caption.text(cap);
// Show lightbox
$lightbox.fadeIn('fast');
$lightbox.click(function () {
$lightbox.fadeOut('fast');
});
});