How can I put an iframe youtube on a frame with icon close. example:- If I want to put the iframe below on frame with icon close, and if I click on icon close the iframe youtube will disappear, how can I do this?

如何将iframe youtube放到带有关闭图标的框架中。例子:-如果我想把iframe与图标关闭,如果我点击图标关闭iframe youtube就会消失,我该怎么做呢?

<iframe width="440" height="215" src="http://www.youtube.com/embed/OyRQio7GfLU" frameborder="0" allowfullscreen></iframe>

Thanks

谢谢

2 个解决方案

#1


4

I'm not sure by 100% if this is what did you expect, but I hope I've helped you.

我不能百分之百确定这是不是你所期望的,但我希望我已经帮助你了。

$(".button").click(function() {
  $("#x").addClass('hide');
});
.frame {
  height: auto;
  width: auto;
  padding: 20px;
  border: 1px solid black;
  position: relative;
}
.button {
  position: absolute;
  top: 5px;
  right: 5px;
  height: 20px;
  width: 20px;
  background-color: black;
  color: white;
}
.content {
  display: block;
}
.hide {
  display: none;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="frame">
  <button class='button'>X</button>
  <iframe id='x' class='content' width="440" height="215" src="http://www.youtube.com/embed/OyRQio7GfLU" frameborder="0" allowfullscreen></iframe>
</div>

更多相关文章

  1. ABP(现代ASP.NET样板开发框架)系列之21、ABP展现层——Javascrip
  2. Ajax中DWR框架使用简单步骤
  3. 在导航图标css下包装文本。
  4. 非常简单的js双向绑定框架(一)
  5. 八款Js框架介绍及比较,Dojo 、Scriptaculous 、Prototype 、yui-
  6. Bottle 框架源码学习 四
  7. 在CentOS 6.3 64bit上搭建python高性能框架gevent开发环境
  8. Scrapy框架--Requests对象
  9. IIS 部署 python web框架 Flask

随机推荐

  1. android 获取网络类型名称2G 3G 4G wifi
  2. A Small Question Left Here
  3. Android Studio入门之常见问题
  4. Android代码混淆官方实现方法
  5. An_ListView 多样展示
  6. 腾讯开源的Android UI框架——QMUI Andro
  7. android应用开发实战
  8. Android多媒体开发(3)————使用Android
  9. android init.rc 分析
  10. android获取短信所有内容