这是我的JavaScript代码...当我向下滚动时,它会将我的nav-bar
置于特殊颜色,但是当我重新启动时,它会保持这种状态。我不能让它回到原色。!!
var myNav = document.getElementById('mynav');
window.onscroll = function () {
"use strict";
if (document.body.scrollTop >= 200) {
myNav.classList.add("bg-dark");
myNav.classList.remove("nav-colored");
}
else {
myNav.classList.add("nav-colored");
myNav.classList.remove("bg-dark");
}
};