0
js를 사용하여 팝업 모달을 쉽게하기 위해 아래 코드를 가지고 있지만 전환 스타일을 추가 할 위치가 확실하지 않은 경우 CSS를 살펴본 결과 아무런 운이 없다고 가정합니다. 그것의 js로해라.js 팝업 모드에서 완화하는 방법
내 코드는 다음과 같습니다.
// Get the modal
var modal = document.getElementById('loginModal');
// Get the button that opens the modal
var btn = document.getElementById("login");
// Get the <span> element that closes the modal
var span = document.getElementsByClassName("close")[0];
// When the user clicks on the button, open the modal
btn.onclick = function() {
modal.style.display = "block";
modal.style.fadeIn(3000);
}
// When the user clicks on <span> (x), close the modal
span.onclick = function() {
modal.style.display = "none".fadeIn(3000);
}
// When the user clicks anywhere outside of the modal, close it
window.onclick = function(event) {
if (event.target == modal) {
modal.style.display = "none";
}
}
어디에 넣을까요? 나는 jquery 미안하다 젠체하는 사람. –
@OwenDawson의 클릭 이벤트 기능. 닫기 : fadeOut 및 fadeIn 열기에 대한 예제를 보여주기 위해 내 대답을 편집했습니다. – G43beli