function popupGrowStage3() {
if (popupContentContainer.style.opacity < 1) {
popupContentContainer.style.opacity+= 0.01;
setTimeout(popupGrowStage3, 1000 / 60);
alert(popupContentContainer.style.opacity);
} else {
isPopupShowing = 1;
}
}
popupGrowStage3();
上面的代码似乎并不是每次都给不透明度增加 0.01。警报一直说 0.01。为什么要这样做?
popupContentContainer.style.width = popup.style.width;
popupContentContainer.style.height = popup.style.height;
popupContentContainer.style.backgroundColor = "#111111";
popupContentContainer.style.opacity = 0;
popup.appendChild(popupContentContainer);
这段代码在那之前