添加关闭图标以嵌入Youtube-Video

时间:2017-09-02 17:34:41

标签: jquery html css

问题在于:

如何添加图标并嵌入Yotube-Video-Window?

1 个答案:

答案 0 :(得分:1)

您只需使用 jquery 执行此操作,请参阅以下示例:

$(function(){
    
      $(".closeBtn").click(function(){
        $($(this).data("target")).fadeOut(500);
      });
    
});
.closeBtn {
  position: absolute;
  cursor: pointer;
  top: 5px;
  left: 5px;
  z-index: 999999;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<div id="v1">
 <div class="closeBtn" data-target="#v1"><img src="http://downloadicons.net/sites/default/files/delete--delete-icon-32231.png" width="30" height="30" /></div>
        <iframe width="932" height="510" src="https://www.youtube.com/embed/v5dU-dG9epY" frameborder="0" allowfullscreen></iframe>
</div>