基本上,我有一个弹出框,它会在点击功能时打开,除了淡入/淡出效果外,它工作得很好。
谁能告诉我如何在下面的代码中添加淡入/淡出效果?
function openPopUp() {
document.getElementById("myOverlay").style.display = "block";
}
function closePopUp() {
document.getElementById("myOverlay").style.display = "none";
}
最佳答案
因为你已经添加了 jquery
标签,我认为它对 jQuery 没问题。
function openPopUp() {
$("#myOverlay").fadeIn(500); // "500" is not required. "400" is the default value
}
function closePopUp() {
$("#myOverlay").fadeOut(500); // "500" is not required. ""400 is the default value
}
更多信息:
关于javascript - 将 FadeIn 和 FadeOut 添加到弹出 JQUERY,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49597421/