求大神赐教,请问如何用JS实现网页的完全全屏.
答案:2 悬赏:50 手机版
解决时间 2021-03-01 19:18
- 提问者网友:刺鸟
- 2021-03-01 08:07
求大神赐教,请问如何用JS实现网页的完全全屏.
最佳答案
- 五星知识达人网友:渡鹤影
- 2021-03-01 09:47
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();
}
};
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();
}
};
全部回答
- 1楼网友:不甚了了
- 2021-03-01 11:02
<marquee><img src="你的图片地址" /></marquee>
这算是纯html的轮播了吧。
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯