2026, 새로운 도약을 시작합니다.

영카트 모달 질문입니다ㅠ 채택완료

<style>
    #sct_wrap{padding:0 5px;}

/* The Modal (background) */
.searchModal {
display: none; /* Hidden by default */
position: fixed; /* Stay in place */
z-index: 10; /* Sit on top */
left: 0;
top: 0;
width: 100%; /* Full width */
height: 100%; /* Full height */
overflow: auto; /* Enable scroll if needed */
background-color: rgb(0,0,0); /* Fallback color */
background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
}
/* Modal Content/Box */
.search-modal-content {
background-color: #fefefe;
margin: 15% auto; /* 15% from the top and centered */
padding: 20px;
border: 1px solid #888;
width: 70%; /* Could be more or less, depending on screen size */
}

</style>

---------------------------------------------------

<div id="modal" class="searchModal">
    <div class="search-modal-content">
        <div class="page-header">
            <h1>공유하기</h1><BR>
        </div>
            <div class="row">
                <div class="col-sm-12">
                    <div class="row">
                        <div class="col-sm-12">
<div id="sit_sns">
            <?php echo get_sns_share_link('facebook', $sns_url, $sns_title, G5_MSHOP_SKIN_URL.'/img/sns_fb.png'); ?>

                <?php echo get_sns_share_link('twitter', $sns_url, $sns_title, G5_MSHOP_SKIN_URL.'/img/sns_twt.png'); ?>

                <!-- 
                    <?php echo get_sns_share_link('googleplus', $sns_url, $sns_title, G5_MSHOP_SKIN_URL.'/img/sns_goo.png'); ?>
                -->

                <?php echo get_sns_share_link('kakaotalk', $sns_url.$a, $sns_title, G5_MSHOP_SKIN_URL.'/img/sns_kakao.png'); ?>

              <!--  <?php echo get_sns_share_link('sms', $sns_url.$a, $sns_title, G5_MSHOP_SKIN_URL.'/img/sms.png'); ?> -->


                <!-- 
                    <a href="javascript:popup_item_recommend('<?php echo $it['it_id']; ?>');" id="sit_btn_rec">추천하기</a>
                -->
    <?php
    $href = G5_SHOP_URL.'/iteminfo.php?it_id='.$it_id;
    
    ?>
</div>
                        </div>
                    </div>
                </div>
            </div>
<hr>
<div style="cursor:pointer;background-color:#DDDDDD;text-align: center;padding-bottom: 10px;padding-top: 10px;" onClick="closeModal();">
        <span class="pop_bt modalCloseBtn" style="font-size: 13pt;">닫기</span>
</div>
</div>
</div>

-------------------------------------------------------------------------------------------------------------

function item_sell(){
             //  window.open('','','width=200,height=200,top=200,scrollbars=no');

 jQuery(document).ready(function () {
$("#modal").show();
});

function closeModal() {
$("#modal").hide();
};

}

와같이 코드를 작성했는데요 닫기버튼을 아무리 눌러도 닫히지가 않네요ㅜ 뭐가문젠지모르겠습니다ㅜㅜ

답변 1개

채택된 답변
+20 포인트

closeModal() 함수 내에 로그를 찍어보세요. 일단 함수 호출이 되는지 확인하시고 호출이 된다면

console.log($('#modal)) 로 셀렉터가 제대로 동작하는지 체크해보세요.

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

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

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

로그인
🐛 버그신고