感谢这位网友提出的bug,已做更正;请替换下面的函数:
window.onresize = function(e) { //判断当前状态是否全屏 f11 var screenwid = screen.width, screenhei = screen.height; var docwid = document.documentElement.clientWidth; var dochei = document.documentElement.clientHeight; if (screenwid == docwid && screenhei == dochei) { document.getElementById(id).parentNode.style.width = screen.width + "px"; document.getElementById(id).parentNode.style.height = screen.height + "px"; intwid(id); parentobj.getElementsByClassName("fullscreen")[0].setAttribute("fs", "true"); } else { document.getElementById(id).parentNode.style.width = document.getElementById(id).parentNode.getAttribute("originwid"); document.getElementById(id).parentNode.style.height = document.getElementById(id).parentNode.getAttribute("originhei"); parentobj.getElementsByClassName("fullscreen")[0].setAttribute("fs", "false"); } parentobj.children[0].style.width = "100%"; parentobj.children[0].style.height = "100%";//初始化长度 } function intwid(id) { var obj = document.getElementById(id).parentNode; obj.setAttribute("originhei", getStyle(obj, "height")) obj.setAttribute("originwid", getStyle(obj, "width")) var fahterwid = obj.clientWidth; var playwid = obj.getElementsByClassName("play")[0].clientWidth; var fullscreenwid = obj.getElementsByClassName("fullscreen")[0].clientWidth; var voicewid = obj.getElementsByClassName("volum")[0].clientWidth; var timewid = obj.getElementsByClassName("totaltime")[0].clientWidth; var lesswidth = fahterwid - playwid - fullscreenwid - voicewid - timewid; obj.getElementsByClassName("timeline")[0].style.width = lesswidth - 30 + "px"; }