Обернуть pinbox в див с классом wrapper-pinbox каждый дополнительно
Вот если немного js модернизировать:
$(function() {
$('.emb').each(function() {
$(this).on('click', function() {
var block = $(this).next('.meta-data'),
pinbox = $(this).parents('.pinbox');
pinbox.toggleClass('pinbox_active');
pinbox.parent().toggleClass('pinbox_parent_active');
if (pinbox.hasClass('pinbox_active')) {
block.slideDown(100);
$(document).on('click', function(event) {
if ($(event.target).closest(pinbox).length)
return;
block.hide(100);
pinbox.removeClass('pinbox_active');
pinbox.parent().removeClass('pinbox_parent_active');
event.stopPropagation();
});
}
});
});
});
И CSS:
* {
margin: 0px;
padding: 0px;
}
.pinbox {
position: absolute;
background-color: #2DC5F2;
width: 321px;
border-radius: 12px;
-webkit-border-radius: 12px;
position: relative;
margin: 14px 0 66px 0;
}
.pinbox_active {
-moz-transition: all 150ms linear;
-o-transition: all 150ms linear;
transition: all 150ms linear;
-webkit-transition: all 150ms linear;
z-index: 10;
box-shadow: 0 0 0.5px rgba(0, 0, 0, 0.8), 70px 50px 85px -8px rgba(57, 70, 78, 0.3);
border-radius: 12px;
-moz-border-radius: 12px;
-webkit-border-radius: 12px;
}
.pinbox_parent_active {
background: #ccc;
}
.pinbox .img {
background-color: #2DC5F2;
width: 321px;
border-radius: 12px;
-webkit-border-radius: 12px;
}
.pinbox .preview .thumb {
height: 120px;
display: block;
overflow: hidden;
position: relative;
}
.pinbox .preview .thumb img {
-webkit-border-radius: 11px 11px 0 0;
border-radius: 11px 11px 0 0;
height: auto;
max-width: 321px;
width: 100%;
}
.emb {
cursor: pointer;
position: absolute;
width: 20%;
height: 65px;
left: 50%;
transform: translateX(-50%);
}
.pinbox .meta-data {
display: none;
position: relative;
font-weight: bold;
height: 75px;
z-index: 1;
}