【发布时间】:2018-02-13 19:34:22
【问题描述】:
我想删除 :before 背景图片。
php文件,
<li class="vi">
<a href="javascript:;">
<span class="play-btn"></span><img src="/v1.jpg" data-video="https://www.youtube.com/embed/Nxj8BWiyypQ?rel=0&showinfo=0&autoplay=1" class="videoGPoster">
</a>
<h5>Videos 2</h5>
</li>
CSS,
.home_gallery .gallery_wheel .recent_photpvideo ul li.vi:before {
position: absolute;
top: 30%;
width: 120px;
height: 120px;
content: "";
background: url(images/play.png);
background-size: cover;
left: 30%;
transform: translate(0%,0%);
.play-btn {
position: absolute;
top: 30%;
width: 120px;
height: 120px;
content: "";
background: url(images/play.png);
background-size: cover;
left: 30%;
transform: translate(0%,0%);
z-index: 1;
}
JS 文件,
jQuery('img.videoGPoster').click(function () {
video = '<iframe width="400" height="300" src="' + jQuery(this).attr('data-video') + '" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>';
jQuery(this).replaceWith(video);
});
我用过这段代码,但它不起作用,
jQuery('.play-btn').click(function () {
alert();
video = '<iframe width="400" height="300" src="' + jQuery(this).attr('data-video') + '" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>';
jQuery(this).replaceWith(video);
});
图片是 => https://prnt.sc/idkci7
我想点击图像按钮然后播放视频然后播放按钮不显示但现在播放按钮显示。请任何人帮助如何使用jquery删除:之前的播放按钮。 => https://prnt.sc/idkeop
【问题讨论】: