0

私は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 コードを編集する方法が見つかりません。

方法はありますか、それとも最初からやり直す必要がありますか?

4

1 に答える 1

1

私はブラウザと格闘し、あなたのためにこれを救いました。次回は気をつけて。

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");

}
于 2013-01-30T07:30:42.010 に答える