Currently, I am developing a website with a feed of images using Instafeed.js. The process of pulling the images, likes, and comments is functioning smoothly.
I have implemented a hover effect that displays the number of likes and comments on an image. You can view the effect here: https://jsfiddle.net/9w1neq9m/3/
#instafeed {
margin-top: 30px;
text-align: center;
font-family: 'brandon-grotesque', sans-serif;
}
.insta-post {
display: inline-block;
margin: 0 10px 20px 10px;
position: relative;
}
.insta-hover {
position: absolute;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
background: rgba(0, 0, 0, .5);
color: white;
opacity: 0;
transition: opacity 1s;
-webkit-transition: opacity 1s;
padding: 0 15px;
}
.insta-hover .fa:last-of-type {
padding-left: 15px
}
.insta-post:hover .insta-hover {
opacity: 1;
transition: opacity 1s;
-webkit-transition: opacity 1s;
}
<div id="instafeed">
<div class="insta-post">
<a href="#" target="_blank">
<div class="insta-hover">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut quam libero, blandit at odio et, fermentum luctus massa. Sed et tortor volutpat, semper orci sit amet, venenatis metus. Nullam scelerisque sem at risus maximus sodales.</p>
<p><i class="fa fa-heart" aria-hidden="true"></i> 130 <i class="fa fa-comment" aria-hidden="true"></i> 29</p>
</div>
<img src="https://unsplash.it/300/300" alt="Image from Instagram">
</a>
</div>
<div class="insta-post">
<a href="#" target="_blank">
<div class="insta-hover">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut quam libero, blandit at odio et, fermentum luctus massa. Sed et tortor volutpat, semper orci sit amet, venenatis metus. Nullam scelerisque sem at risus maximus sodales.</p>
<p><i class="fa fa-heart" aria-hidden="true"></i> 130 <i class="fa fa-comment" aria-hidden="true"></i> 29</p>
</div>
<img src="https://unsplash.it/300/300" alt="Image from Instagram">
</a>
</div>
</div>
Due to limitations on mobile devices, the current setup does not work as intended. Tapping directly leads to the link, which is not the desired behavior.
My goal is to activate the hover effect on the first tap, and only navigate to the link upon a second tap by the user.
I came across this resource http://www.hnldesign.nl/work/code/mouseover-hover-on-touch-devices-using-jquery/ that seems to offer a solution to my issue. However, I am having trouble implementing it, particularly with the hide/show hover functionality.