모바일 팝업 질문

모바일 팝업 질문

QA

모바일 팝업 질문

본문

 pc에서는 팝업창을 아래 사진과같이 띄웠구요

2041395728_1675066368.1112.png

 

모바일에서는  아래와같이 css 수정해서 띄웠습니다!!

2041395728_1675066393.4761.png

 

 

그런데 이미지사이즈가 600이여서 그런지 모바일에서 이미지가 짤려보입니다..

어디를 수정해야 모바일 사이즈에 맞춰서 크기가 줄어드나요??

 

 

newwin.inc.php

 

 

<!-- 팝업레이어 시작 { -->

<div id="hd_pop">

    <h2>팝업레이어 알림</h2>

    <div class="pop_wrap">

            <?php

        for ($i=0; $nw=sql_fetch_array($result); $i++)

        {

            // 이미 체크 되었다면 Continue

            if (isset($_COOKIE["hd_pops_{$nw['nw_id']}"]) && $_COOKIE["hd_pops_{$nw['nw_id']}"])

                continue;

        ?>

 

            <div id="hd_pops_<?php echo $nw['nw_id'] ?>" class="hd_pops" style="top:<?php echo $nw['nw_top']?>px;left:<?php echo $nw['nw_left']?>px">

                <div class="hd_pops_con" style="width:<?php echo $nw['nw_width'] ?>px;height:<?php echo $nw['nw_height'] ?>px">

                    <?php echo conv_content($nw['nw_content'], 1); ?>

                </div>

                <div class="hd_pops_footer">

                    <button class="hd_pops_reject hd_pops_<?php echo $nw['nw_id']; ?> <?php echo $nw['nw_disable_hours']; ?>"><strong><?php echo $nw['nw_disable_hours']; ?></strong>시간 동안 다시 열람하지 않습니다.</button>

                    <button class="hd_pops_close hd_pops_<?php echo $nw['nw_id']; ?>">닫기 <i class="fa fa-times" aria-hidden="true"></i></button>

                </div>

            </div>

        <?php }

        if ($i == 0) echo '<span class="sound_only">팝업레이어 알림이 없습니다.</span>';

        ?>

    </div>

 

</div>

 

 

 

 

 

default.css

 

/* 팝업레이어 */

#hd_pop {z-index:1000;position:relative;margin:0 auto;height:100%; width: 100%;}

#hd_pop h2 {position:absolute;font-size:0;line-height:0;overflow:hidden}

.hd_pops {position:absolute;border:1px solid #e9e9e9;background:#fff}

.hd_pops img {max-width:100%}

.hd_pops_con {}

.hd_pops_footer {padding:0;background:#000;color:#fff;text-align:left;position:relative}

.hd_pops_footer:after {display:block;visibility:hidden;clear:both;content:""}

.hd_pops_footer button {padding:10px;border:0;color:#fff}

.hd_pops_footer .hd_pops_reject {background:#000;text-align:left}

.hd_pops_footer .hd_pops_close {background:#393939;position:absolute;top:0;right:0}

.pop_wrap{}

@media all and (max-width:1280px){

    #hd_pop{width: 85% !important; height: auto !important; margin: 0 5px;}

    #hd_pops_1{left: 0 !important;}

    #hd_pops_2{top: 500px !important; left: 0 !important;}

    #hd_pops_3{top: 900px !important; left: 0 !important;}

    #hd_pops_4{top: 1300px !important; left: 0 !important;}

    .hd_pops_con{width: 100% !important;}

    .pop_wrap{}

}

 

 

 

이 질문에 댓글 쓰기 :

답변 5

default.css

 

/* 팝업레이어 */

#hd_pop {z-index:1000;position:relative;margin:0 auto;height:100%; width: 100%;}

#hd_pop h2 {position:absolute;font-size:0;line-height:0;overflow:hidden}

.hd_pops {position:absolute;border:1px solid #e9e9e9;background:#fff}

.hd_pops img {max-width:100%}

.hd_pops_con {}

.hd_pops_footer {padding:0;background:#000;color:#fff;text-align:left;position:relative}

.hd_pops_footer:after {display:block;visibility:hidden;clear:both;content:""}

.hd_pops_footer button {padding:10px;border:0;color:#fff}

.hd_pops_footer .hd_pops_reject {background:#000;text-align:left}

.hd_pops_footer .hd_pops_close {background:#393939;position:absolute;top:0;right:0}

.pop_wrap{}

@media all and (max-width:1280px){

    #hd_pop{width: 85% !important; height: auto !important; margin: 0 5px;}

    .hd_pops img {width:100%} <-- 모바일에서 가로폭 100%

    #hd_pops_1{left: 0 !important;}

    #hd_pops_2{top: 500px !important; left: 0 !important;}

    #hd_pops_3{top: 900px !important; left: 0 !important;}

    #hd_pops_4{top: 1300px !important; left: 0 !important;}

    .hd_pops_con{width: 100% !important;}

    .pop_wrap{}

}

 

이렇게만 해주셔도 될듯 합니다.

 

아마도 해당 img 에 대한 css 가 css 파일이 아닌 소스 자체에 있을수도 있습니다.

 

.hd_pops img {width:100% !important;}

이렇게 적용해보시고 그래도 안되면 URL 을 봐야할것 같네요.

다시 보니 선택자가 잘못되었네요..

위 소스에는 hd_pops 내에 img 가 없어보입니다.

일단 hd_pops 이결 hd_pop 로 바꿔보세요.

 

.hd_pop img {width:100% !important;}

소스가 엉망이네요;;;

position:absolute; 할당시 상위 객체에서 relative 등으로 가두지 않으면 전체 기준으로 너비값이 할당됩니다.

pop_wrap 이 객체에 position:relative; 할당해보세요..

 

추가로

hd_pops_?? 객체값을 width:100% 를 주어도 이미 상위 객체에서 디바이스 크기보다 width 값이 크게 되어있습니다.

hd_pops_?? 객체값에 width:100px 로 변경해보시면 제가 말하는 의미를 아실거에요.

 

결론.

하위 객체의 너비를 width:100% 로 하려면

상위 객체의 너비를 채크해야합니다.

답변을 작성하시기 전에 로그인 해주세요.
전체 123,125 | RSS
QA 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1404호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT