求大神赐教,请问如何用JS实现网页的完全全屏. 10
1个回答
展开全部
Option.prototype.toggleFullscreen = function() {
if ((document.fullScreenElement && document.fullScreenElement !== null) ||
(!document.mozFullScreen && !document.webkitIsFullScreen)) {
this.enterFullscreen(document.documentElement);
} else {
this.cancelFullscreen();
}
};
Option.prototype.enterFullscreen = function(docElm) {
if (docElm.requestFullscreen) {
docElm.requestFullscreen();
}
else if (docElm.mozRequestFullScreen) {
docElm.mozRequestFullScreen();
}
else if (docElm.webkitRequestFullScreen) {
docElm.webkitRequestFullScreen();
}
};
Option.prototype.cancelFullscreen = function(){
if (document.exitFullscreen) {
document.exitFullscreen();
}
else if (document.mozCancelFullScreen) {
document.mozCancelFullScreen();
}
else if (document.webkitCancelFullScreen) {
document.webkitCancelFullScreen();
}
};
追问
把你的代码放到Html中,网页没有全屏,还是能最小化网页啊?这是你自己写的代码吗?有什么注意事项?
追答
I don't know
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询