Whing Dela Cruz
asked on
Diminish Pop-up in 3 seconds
Hi Expert, I have attached a sample pop-up here where I want to put some codes that would enable the pop-up diminish in 3 seconds. Is this possible? Any help please.
<script>
function myFunction() {
var popup = document.getElementById("m yPopup");
popup.classList.toggle("sh ow");
}
</script>
<script>
function myFunction() {
var popup = document.getElementById("m
popup.classList.toggle("sh
}
</script>
ASKER
Hi David Johnson,
I tried it but it doesn't work. A popup will no longer appear as I tried to add this, "}" at the end part of the code as i felt lacking on the codes but result is still the same.
I tried it but it doesn't work. A popup will no longer appear as I tried to add this, "}" at the end part of the code as i felt lacking on the codes but result is still the same.
Use the setTimeout function for it.
<script>
function myFunction() {
var popup = document.getElementById("myPopup");
popup.style.display = "block"; // Or whatever way you want to show it.
setTimeout(function() {
popup.style.display = "none"; //Or whatever way you want to hide it.
}, 3000);
</script>
ASKER
Hello Rawat,
Still won't work, pop-up will no longer appear upon implementing the codes..
Still won't work, pop-up will no longer appear upon implementing the codes..
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I added "}" at the end part of the codes, now its working. Thank you very much sir!
ASKER
Thank you sir More power and God bless!
Open in new window