将一个youtube iframe放在另一个具有关闭图标的框架上
16lz
2021-01-22
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>
更多相关文章
- ABP(现代ASP.NET样板开发框架)系列之21、ABP展现层——Javascrip
- Ajax中DWR框架使用简单步骤
- 在导航图标css下包装文本。
- 非常简单的js双向绑定框架(一)
- 八款Js框架介绍及比较,Dojo 、Scriptaculous 、Prototype 、yui-
- Bottle 框架源码学习 四
- 在CentOS 6.3 64bit上搭建python高性能框架gevent开发环境
- Scrapy框架--Requests对象
- IIS 部署 python web框架 Flask