我使用jsbin测试了一些与iframe相关的代码,这里是我的工作http://www.jsbin.com/evidez/1/edit的链接。
我错误地将iframe的url设置为http://stackoverflow.com,现在当http://www.jsbin.com/evidez/1/edit加载时,然后弹出一个警告,并在关闭它时重定向到http://stackoverflow.com。
我找不到任何方法来编辑我的jsbin代码。
有没有出路,还是我必须从头再来?
发布于 2013-01-30 15:30:42
我费了很大力气才把它抢救出来。下次要当心。
HTML
<!doctype html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<title>Full Screen Example</title>
</head>
<body>
<button id="fullsc">set source to iframe and take me full screen</button><br><br>
<iframe id="myvideo" src="http://stackoverflow.com"></iframe>
</body>
</html>CSS
/* make the video stretch to fill the screen in WebKit */
:-webkit-full-screen #myvideo {
width: 100%;
height: 100%;}
iframe{
position: absolute;
height: 100%;
width:100%
}Javascript
var videoElement = $('#myvideo');
var fullsc = $('#fullsc');
function toggleFullScreen() {
if (!document.mozFullScreen && !document.webkitFullScreen) {
if (videoElement.mozRequestFullScreen) {
videoElement.mozRequestFullScreen();
} else {
videoElement.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT);
}
} else {
if (document.mozCancelFullScreen) {
document.mozCancelFullScreen();
} else {
document.webkitCancelFullScreen();
}
}
}
document.addEventListener("keydown", function(e) {
if (e.keyCode == 13) {
toggleFullScreen();
}
}, false);
fullsc.onclick = function(){
//setiframeurl();
toggleFullScreen();
};
function setiframeurl(){
$('#myvideo').attr('src', "http://radbox.me/watch/mobile?c=21&du=35");
}https://stackoverflow.com/questions/14582248
复制相似问题