How to fade in my Pop-Up when using display: none
and display: block
in javascript?
Also, I want to know how I am supposed to use it for the picture slider. I want the PopUp to fade in and out when I close it and I want a transition between the pictures when I am clicking to the next photo.
The "modal" is the PopUp and "mySlides" are the photos.
var slideIndex;
var mySlides;
function openModal(modalName, myModalSlides) {
document.getElementById(modalName).style.display = "block";
document.getElementById(modalName).fadeIn(); //???
mySlides = document.getElementById(myModalSlides);
}
function closeModal(modalName) {
document.getElementById(modalName).style.display = "none";
document.getElementById(modalName).fadeOut(); //???
mySlides = null;
}
function plusSlides(index) {
showSlides(slideIndex += index);
Element.style.opacity = 1;
}
function currentSlide(index) {
showSlides(slideIndex = index);
}
function showSlides(index) {
var i;
if (index > mySlides.childElementCount) { slideIndex = 1 }
for (i = 0; i < mySlides.childElementCount; i++) {
mySlides.children[i].style.display = "none";
}
mySlides.children[slideIndex - 1].style.display = "block";
}