【发布时间】:2020-12-21 13:50:24
【问题描述】:
我想制作一个看起来像 cmd 的网站。它基本上完成了,但我认为如果我再添加一项功能会看起来好多了。我想这样做,当您单击最大化按钮时,应该最大化 cmd。一切都完成了,除了这件事,当您再次单击最大化按钮时,它不会恢复默认大小。 知道如何解决吗?
代码:(我尝试在 if-else 和 do-while 语句中实现,但没有真正奏效。)
function maxiMize() {
var maximize = document.getElementById("maximize");
var term_head = document.getElementById("term_head");
var terminal_main = document.getElementById("terminal_main");
var main_header = document.getElementById("main_header");
var x = 0;
if (maximize.style.height = "800px") {
terminal_main.style.width = "auto";
terminal_main.style.height = "100%";
terminal_main.style.margin = "0";
term_head.style.width = "auto";
term_head.style.margin = "0";
document.getElementById('term_head').style.borderRadius = "0";
document.getElementById('term_head').style.MozBorderRadius = "0";
main_header.style.position = "relative";
main_header.style.width = "99.999%";
document.body.style.background = "#000";
x = 1;
} else if (maximize.style.height != "800px") {
terminal_main.style.width = "auto";
terminal_main.style.margin = "0 15%";
terminal_main.style.height = "800px";
term_head.style.width = "auto";
term_head.style.margin = "0";
document.getElementById('term_head').style.borderRadius = "15px";
document.getElementById('term_head').style.MozBorderRadius = "15px";
main_header.style.position = "fixed";
main_header.style.width = "100%";
document.body.style.background = "#333";
x = 0;
}/*
do {
terminal_main.style.width = "auto";
terminal_main.style.height = "100%";
terminal_main.style.margin = "0";
term_head.style.width = "auto";
term_head.style.margin = "0";
document.getElementById('term_head').style.borderRadius = "0";
document.getElementById('term_head').style.MozBorderRadius = "0";
main_header.style.position = "relative";
main_header.style.width = "99.999%";
document.body.style.background = "#000";
x = 1;
}while(x !=1); */
}
- 列表项
【问题讨论】:
标签: javascript html css linux window