[英]Disfigured Layout due to Webkit Full-screen in Chrome
I have a problem with two nested full-screen elements.我有两个嵌套的全屏元素的问题。 When a user enters full-screen mode of the outer div
and then enters the full-screen mode of the nested <video>
, the state of the site should be the same as the user only entering fullscreen mode of the outer <div>
.当用户进入外层div
的全屏模式,然后进入嵌套<video>
的全屏模式时,站点的状态应该与用户仅进入外层<div>
全屏模式相同。 Only in Internet Explorer and Firefox is it working as it should.只有在 Internet Explorer 和 Firefox 中才能正常工作。
In Google Chrome, the layout breaks after leaving full-screen mode of the nested <vidoeo>
.在 Google Chrome 中,离开嵌套<vidoeo>
的全屏模式后布局会中断。 It seems like the fullscreen mode of one of these element sis not entirely cancelled or the two full-screen modes are conflicting.这些元素之一的全屏模式似乎没有完全取消,或者两种全屏模式存在冲突。
To reproduce this, exit full screen with the button, not with the ESC
key.要重现这一点,请使用按钮退出全屏,而不是使用ESC
键。
See the jsFiddle .请参阅jsFiddle 。
function requestFullScreen() {
var element = document.getElementById('fullscreen-wrapper'),
fullscreenFunction = element.webkitRequestFullScreen || element.mozRequestFullScreen || element.requestFullScreen || element.msRequestFullScreen;
fullscreenFunction.call(element);
}
function exitFullScreen() {
var element = document,
fullscreenFunction = fullscreenFunction = element.webkitExitFullscreen || element.mozCancelFullScreen || element.exitFullscreen || element.msExitFullscreen;
fullscreenFunction.call(element);
}
document.querySelector('btn-fullscreen')[0].addEventListener('click', requestFullScreen);
document.querySelector('btn-exit')[0].addEventListener('click', requestFullScreen);
<div id="fullscreen-wrapper" class="wrapper">
<button class="btn-fullscreen">enter fullscreen</button>
<button class="btn-exit">exit fullscreen</button>
<video controls>
<source type="video/mp4" src="http://www.sample-videos.com/video/mp4/720/big_buck_bunny_720p_1mb.mp4">
</video>
</div>
这已在 3 年前在 Chrome 中修复: https : //bugs.chromium.org/p/chromium/issues/detail?id=685620
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.