모달을 여는 데 다음 코드를 사용하고 있습니다.모달 문제 닫기
모달이 예상대로 열리고 - 부모 클래스에 open
을 추가합니다. 그러나 '닫기'를 클릭하면 닫히지 않습니다. & close
은 수업에 추가되지 않습니다.
누군가 설명 할 수 있습니까?
<script type="text/javascript">
jQuery(document).ready(function($) {
$window = $(window)
$(".modal-trigger").click(function(e) {
e.preventDefault()
var id = $(e.target).attr("href")
$(id).addClass("open")
$(id).find('.close').click(function(e) {
e.preventDefault()
$(e.target).parent().removeClass(".open")
});
})
});
</script>
내 Close
버튼 HTML : <button class="close icon-close"></button>
[수동] (http://api.jquery.com/removeclass/) :'.removeClass ('open') '을 읽으십시오. –
** 세미콜론 **이 사용 된 점은 필요 없습니다. ? –
'.'을 제거해도이 문제가 해결되지 않습니다. – michaelmcgurk