테스트 사이트 - 개발 중인 베타 버전입니다

모달팝업 질문 채택완료

ZDZ 1년 전 조회 1,212

</p>

<p>        <div class="modal">

            <ul class="img_box mb0">

                <li>

                  <a href="javascript:void(0);" class="modal_btn"><img src="사진" alt=""></a>

                  <div class="modal_popup">

                    <div class="modal_con">

                      <img src="사진" alt="">

                      <p>테스트 텍스트</p>

                    </div>

                    <button type="button" class="modal_close"><img src="사진" alt=""></button>

                  </div>

                </li></p>

<p>       </ul></p>

<p></div></p>

<p> </p>

<p>    <script>

        $('.modal_btn').click(function(){

            $(this).siblings().show()

            $('.modal_close').click(function(){

                $('.modal').hide()

            })

        })

        $(document).mouseup(function (e){

          var LayerPopup = $(".modal_popup");

            if(LayerPopup.has(e.target).length === 0){

                if(!($(event.target).get(0).scrollHeight > $(event.target).innerHeight())){ //스크롤 시 닫히지 않게

                    LayerPopup.hide();

                }

          }

        });

    </script></p>

<p>

</p>

<p>.cd .img_box {display:flex; gap:1rem 6rem;  flex-wrap: wrap;}

.cd .img_box > li {width:calc((100% - 6rem * 2)/3);}</p>

<p>/* 팝업창 */

 .cd .modal {position:relative;}

 .cd .modal_popup {display:none; position: fixed; top: 0; left: 0;  width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.65); z-index: 9999;}

.cd .modal .modal_con {display: flex; justify-content: center; align-items: center; flex-direction: column; width:38.2rem; height:23.6rem; background:#fff; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);}

.cd .modal .modal_con  > p {padding-left: 0rem; font-size: 1.1rem; margin-top: 2.5rem;}

.cd .modal .modal_close {position: absolute; top: 9.35rem; right: 22.1rem;}</p>

<p>

 

http://sir.kr/data/editor/2404/1889326033_1712134637.4028.png" width="100%" />

 

안녕하세요

이미지로 된 버튼을 누르면 나오는 모달팝업 코드를 만들었습니다

 

눌러서 팝업 나오고 닫기 버튼으로 없애는거까지 잘되는데 css가 말썽입니다. 첨부한 사진을 보시다싶이... fixed 하고 width height 모두 100% 했는데 화면 전체를 채우지 못하고 부모 요소만 꽉 채워서 되게 이상해보입니다;;;; 대체 뭐가 문제여서 이렇게 나오는걸까요?

댓글을 작성하려면 로그인이 필요합니다.

답변 1개

toqurk
1년 전

크롬의 개발자 도구(F12) 를 사용하셔서 어디에 문제가 되는지 여부를 먼저 확인해보시면 빠르게 

알수 있습니다.

로그인 후 평가할 수 있습니다

답변에 대한 댓글 2개

Z
ZDZ
1년 전
안녕하세요 ㅠㅠ 다른 사이트에서도 쓰던 코드고 개발자 도구로 계속 뜯어봐도 뭐가 문젠지 모르겠어서 글 남겨보았습니다..
t
toqurk
1년 전
링크를 주시던지...무언가 봐야 알듯 합니다.
전 저 모달을 어찌 짯는지 모르니깐요^^

댓글을 작성하려면 로그인이 필요합니다.

답변을 작성하려면 로그인이 필요합니다.

로그인