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

모바일 팝업 질문 채택완료

콩이지니 2년 전 조회 1,910

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

 

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

 

 

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

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

 

 

newwin.inc.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;

        ?>

 

           

               

                   

               

               

           

       

        if ($i == 0) echo '팝업레이어 알림이 없습니다.';

        ?>

   

 

 

 

 

 

 

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개

채택된 답변
+20 포인트

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{}

}

 

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

 

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

답변에 대한 댓글 2개

해피정
2년 전
hd_pops img {max-width:600px; width:100%}
팝업 크기가 600 이라고 했으니 max-width 도 추가하면 괜찮을듯 하네요
콩이지니
2년 전
답변 감사합니다!
그런데 주신 대로 했는데도 똑같이되네용 ㅠㅠ 다른방법 없을까요??

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

들레아빠

style="width:100%;height:autowidth:600px;height:350px"

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

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

소스가 엉망이네요;;;

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

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

 

추가로

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

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

 

결론.

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

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

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

답변에 대한 댓글 1개

콩이지니
2년 전
제가 코딩한게 아니여서 어딘지를 몰랐습니다 ㅜ 답변 감사합니다!

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

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

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

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

 

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

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

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

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

 

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

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

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

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

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

로그인