In a video gallery (made with Isotope) containing embedded iframe YouTube videos, there is for each one a same custom play icon I created (thanks to this post from Rob W). When I'm clicking on the custom icon, it disappears (basically I'm making it transparent with CSS and JQuery "click" function).
The problem is that when I'm clicking on one of these icons, all the other ones are disappearing too, because the play icon visible in front of these iframe elements are all sharing a same CSS class.
What could I do to make each custom play icons individual, tied to its own Youtube embedded iframe element ?
Here is some code :
My JQuery :
$(document).ready(function(){
$('.playbutton').click(function(){
$('.playbutton').css({
'background': '#fff0',
'transition': 'all 1s ease'
});
$('.playbutton-triangle').css({
'border-color': 'transparent #80808000',
'transition': 'all 1s ease'
});
});
});
And some HTML showing how my videos are displayed :
<div class="item-nf cate1" id="video1">
<a href="javascript:void callPlayer("video1","playVideo")" class="playbutton">
<div class="playbutton-triangle"></div>
</a>
<iframe width="400" height="225" src="https://www.youtube.com/embed/A_YOUTUBE_VIDEO_ID?showinfo=0&rel=0&enablejsapi=1" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>
</div>
<div class="item-nf cate2" id="video2">
etc...
And here is a CodePen showing it concretely.
I thought use the "nth-child()" CSS element, but I don't know if I could use it considering my actual code. There is maybe also easier, like directly use JQuery to make the icon disappear without modifying the CSS, but I think it would be the exact same.
Thanks a lot for reading !