JSFiddle - React, Tailwind, and code Playground

by Wesley Smith

HTML

<div class="container rounded-bg">
    <a href="#related-url"><img src="http://placehold.it/400x300?text=.related-img" class="related-img effects rounded" />
    <div class="content">
        <div class="content-top">
            <a href="#unrelated-url" class="unrelated effects">Unrelated Link</a>
        </div>
        <div class="content-bottom">
            <a href="#related-url" class="related effects"><h1>Related Link</h1></a>
        </div>
    </div>
</div>
<br /><br />
<div class="container rounded-bg">
    <a href="#related-url"><img src="http://placehold.it/400x300?text=.related-img" class="related-img effects rounded" />
    <div class="content">
        <div class="content-top">
            <a href="#unrelated-url" class="unrelated effects">Unrelated Link</a>
        </div>
        <div class="content-bottom">
            <a href="#related-url" class="related effects"><h1>Related Link</h1></a>
        </div>
    </div>
</div>
<br /><br />
<div class="container rounded-bg">
    <a href="#related-url"><img src="http://placehold.it/400x300?text=.related-img" class="related-img effects rounded" />
    <div class="content">
        <div class="content-top">
            <a href="#unrelated-url" class="unrelated effects">Unrelated Link</a>
        </div>
        <div class="content-bottom">
            <a href="#related-url" class="related effects"><h1>Related Link</h1></a>
        </div>
    </div>
</div>
<br /><br />
<div class="container rounded-bg">
    <a href="#related-url"><img src="http://placehold.it/400x300?text=.related-img" class="related-img effects rounded" />
    <div class="content">
        <div class="content-top">
            <a href="#unrelated-url" class="unrelated effects">Unrelated Link</a>
        </div>
        <div class="content-bottom">
            <a href="#related-url" class="related effects"><h1>Related Link</h1></a>
        </div>
    </div>
</div>

CSS

body {
    font-family: sans-serif;
}
div.container {
    position: relative;
    background-color: #000;
    display: inline-block;
    height: 300px;
    width: 400px;
}
div.content {
    height: 100%;
    width: 100%;
}
div.content-top {
    position: absolute;
    right: 20px;
    top: 20px;
}
div.content-top {
    position: absolute;
    right: 20px;
    top: 20px;
}
div.content-bottom {
    position: absolute;
    left: 20px;
    bottom: 0;
}
.related-img.active{
    opacity: .9;
}
a.unrelated {
    background-color: #ccc;
    background-color: rgba(0,0,0,0.4);
    color: #fff;
    font-size: 13px;
    padding: 5px 15px;
    text-transform: uppercase;
}
a.unrelated:hover {
    background-color: rgba(0,0,0,0.7);
}
a.related {
    text-decoration: none;
    color: #999;
}
a.unrelated {
    text-decoration: none;
}
a.related.active{
    color: #000;
}
.effects {
    -moz-transition: background-color 500ms, opacity 500ms, color 500ms ease-out;
    -ms-transition: background-color 500ms, opacity 500ms, color 500ms ease-out;
    -o-transition: background-color 500ms, opacity 500ms, color 500ms ease-out;
    -webkit-transform: translateZ(0px);
    -webkit-transition: background-color 500ms, color 500ms ease-out;
    transition: background-color 500ms, opacity 500ms, color 500ms ease-out;
}
.rounded {
    -moz-border-radius: 3px;
    -webkit-border-radius: 3px;
    border-radius: 3px;
}
.rounded-bg {
    -moz-border-radius: 5px;
    -webkit-border-radius: 5px;
    border-radius: 5px;
}

JavaScript

$('.container').on('mouseenter', '.related, .related-img', function(){
    $link = $(this).closest('.container').find('.related, .related-img').addClass('active');
});
$('.container').on('mouseleave', '.related, .related-img', function(){
    $link = $(this).closest('.container').find('.related, .related-img').removeClass('active');
});