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

해당 팝업레이어에는 자기창닫기와 부모창 제어가 없습니다. 어쩌죠? 채택완료

디자인아루즈 4개월 전 조회 709

</p>

<p><?php

if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가</p>

<p>if (!defined('_SHOP_')) {

    $pop_division = 'comm';

} else {

    $pop_division = 'shop';

}</p>

<p>$sql = " select * from {$g5['new_win_table']}

          where '".G5_TIME_YMDHIS."' between nw_begin_time and nw_end_time

            and nw_device IN ( 'both', 'pc' ) and nw_division IN ( 'both', '".$pop_division."' )

          order by nw_id asc ";

$result = sql_query($sql, false);

?></p>

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

<div id="hd_pop">

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

<p><?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;

?></p>

<p>    <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></p>

<p><script>

$(function() {

    $(".hd_pops_reject").click(function() {

        var id = $(this).attr('class').split(' ');

        var ck_name = id[1];

        var exp_time = parseInt(id[2]);

        $("#"+id[1]).css("display", "none");

        set_cookie(ck_name, 1, exp_time, g5_cookie_domain);

    });

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

        var idb = $(this).attr('class').split(' ');

        $('#'+idb[1]).css('display','none');

    });

    $("#hd").css("z-index", 1000);

});

</script>

<!-- } 팝업레이어 끝 --></p>

<p>

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

답변 2개

채택된 답변
+20 포인트
4개월 전

다음 코드를 <script> ~ </script> 안에 넣어주면 됩니다.

</p>

<p>// 팝업 내 이미지 클릭 시 부모창 URL 변경 및 레이어 팝업 닫기

$('.hd_pops_con img').click(function() {

    var targetUrl = '<a href="https://www.example.com/target-page.html';" target="_blank" rel="noopener noreferrer">https://www.example.com/target-page.html';</a> // 샘플 URL

    parent.location.href = targetUrl;

    $(this).closest('.hd_pops').css('display', 'none');

});</p>

<p>

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

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

4개월 전

그래서 뭘 하고 싶으신거죠?

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

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

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

로그인