第6天 用js实现最大化和最小化窗口
const toggleFullScreen = () => {
if (!document.fullscreen && !document.fullscreenElement) {
document.documentElement.requestFullscreen();
// false, null
} else {
document.exitFullscreen();
// true, html dom
}
}
document.addEventListener("keydown", (e) => {
// Enter
if (e.keyCode === 13) {
toggleFullScreen();
}
}, false);
共有 0 条评论