t

모바일환경 팝업창 이미지 리사이즈

· 2014-02-19 (수) 21:14:10 · 8818 · 5
모바일기기 브라우저 크기에 따라 이미지를 리사이즈 합니다.

가로사이즈만 고려했습니다.

mobile/newwin.inc.php 파일을 아래와 같이 수정하세요.

top, left는 0px로 고정합니다.

일단은 오류가 없는 것 같네요.

창이 여러개인 경우는 테스트하지 못했습니다. 이 경우 오류가 있을 것 같지만...

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

if (!defined('_SHOP_')) {
$pop_division = 'comm';
} else {
$pop_division = 'shop';
}

$sql = " select * from {$g5['new_win_table']}
where '".G5_TIME_YMDHIS."' between nw_begin_time and nw_end_time
and nw_device IN ( 'both', 'mobile' ) and nw_division IN ( 'both', '".$pop_division."' )
order by nw_id asc ";
$result = sql_query($sql, false);
for ($i=0; $row_nw=sql_fetch_array($result); $i++)
{
// 이미 체크 되었다면 Continue
if ($_COOKIE["hd_pops_{$row_nw['nw_id']}"])
continue;

$sql = " select * from {$g5['new_win_table']} where nw_id = '{$row_nw['nw_id']}' ";
$nw = sql_fetch($sql);

$nw_height = $nw['nw_height'] + 42;
?>

<!-- 팝업레이어 시작 { -->
<div id="hd_pops_<?php echo $nw['nw_id'] ?>" class="hd_pops" style="top:0px;left:0px;width:<?php echo $nw['nw_width'] ?>px;height:<?php echo $nw_height ?>px">
<div class="hd_pops_con">
<?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']; ?>">닫기</button>
</div>
</div>
<script>
$(document).ready(function() {
$width = $(window).width();

if ($width < <?php echo $nw['nw_width']?>)
{
$('img').css({
'max-width' : $width , 'height' : 'auto'
});

$('.hd_pops').css({
'max-width' : $width , 'height' : 'auto'
});
}
});
</script>
<?php }
if ($i == 0) echo '<span class="sound_only">팝업레이어 알림이 없습니다.</span>';
?>

<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');
});
});
</script>
<!-- } 팝업레이어 끝 -->


* 그누보드5에도 적용 가능합니다.
|

댓글 5개

수정해 보았습니다.
감사합니다^^!
좋은팁 감사합니다.^^
팝업이 아에 안뜨네요..ㅠㅠ
감사합니다.^^
댓글을 작성하시려면 로그인이 필요합니다.

영카트5 팁자료실

455건
+
제목 글쓴이 날짜 조회
14-06-10 조회 7,743
14-05-30 조회 1.1만
14-05-24 조회 8,921
14-05-05 조회 1.1만
14-04-27 조회 9,671
14-04-22 조회 6,532
14-04-21 조회 8,263
14-04-14 조회 7,583
14-03-28 조회 6,627
14-03-22 조회 1.4만
14-03-20 조회 5,470
14-03-18 조회 7,869
14-03-13 조회 2.3만
14-03-13 조회 6,801
14-02-27 조회 9,571
14-02-25 조회 1.2만
14-02-20 조회 9,549
14-02-19 조회 1만
14-02-19 조회 8,819
14-02-17 조회 8,536
14-02-12 조회 1.1만
14-02-09 조회 8,083
14-02-09 조회 6,673
14-02-08 조회 7,926
14-02-06 조회 5,459
14-02-05 조회 9,583
14-01-29 조회 8,284
14-01-24 조회 5,053
14-01-23 조회 5,140
14-01-19 조회 1만