상품상세 이미지 크게 보기 팝업관련 스크립트 수정

This commit is contained in:
chicpro
2013-05-06 11:09:19 +09:00
parent ead7c64928
commit e50e31bd9a
2 changed files with 40 additions and 11 deletions

View File

@ -156,7 +156,7 @@ else
$img_big = $it['it_id'].'_l1'; // 기본이미지(대)
?>
<div id="sit_pvi_big">
<?php echo get_large_image($it['it_id'].'_l1', $it['it_id'], false); ?><?php echo get_it_image($img_big); ?><span class="sound_only">새창</span></a>
<a href="<?php echo G4_SHOP_URL; ?>/largeimage.php?it_id=<?php echo $it['it_id']; ?>&amp;img=<?php echo $img_big; ?>" id="<?php echo $img_big; ?>" class="popup_item_image" target="_blank"><img src="<?php echo G4_DATA_URL; ?>/item/<?php echo $img_big; ?>" alt=""></a>
</div>
<?php
// 이미지(중) 썸네일
@ -487,10 +487,26 @@ else
<!-- 관련상품 end -->
<script>
$(function(){ // 이미지 미리보기
$('#sit_pvi .img_thumb').bind('hover focus', function(){
var img_src = $(this).attr('id').replace("_s", "_l1");
$('#sit_pvi_big img').attr('src','<?php echo G4_DATA_URL; ?>/item/'+img_src); // 이미지 소스 교체
$(function(){
// 이미지 미리보기
$("#sit_pvi .img_thumb").bind("hover focus", function(){
var img_src = $(this).attr("id").replace("_s", "_l1");
$("#sit_pvi_big img").attr("src","<?php echo G4_DATA_URL; ?>/item/"+img_src); // 이미지 소스 교체
$("#sit_pvi_big a").attr("id", img_src);
});
// 상품이미지 크게보기
$(".popup_item_image").click(function() {
var it_id = "<?php echo $it['it_id']; ?>";
var img = $(this).attr("id");
var top = 10;
var left = 10;
var url = "<?php echo G4_SHOP_URL; ?>/largeimage.php?it_id=" + it_id + "&img=" + img;
var opt = 'scrollbars=yes,top='+top+',left='+left;
popup_window(url, "largeimage", opt);
return false;
});
});

View File

@ -2,9 +2,15 @@
define('_SHOP_', true);
include_once('./_common.php');
$sql = " select it_name from {$g4['shop_item_table']} where it_id='$it_id' ";
$it_id = $_GET['it_id'];
$img = $_GET['img'];
$sql = " select it_id, it_name from {$g4['shop_item_table']} where it_id='$it_id' ";
$row = sql_fetch_array(sql_query($sql));
if(!$row['it_id'])
alert_close('상품정보가 존재하지 않습니다.');
$imagefile = G4_DATA_PATH."/item/$img";
$imagefileurl = G4_DATA_URL."/item/$img";
$size = getimagesize($imagefile);
@ -27,8 +33,9 @@ include_once(G4_PATH.'/head.sub.php');
{
if ($i == 1) echo '<ul>';
if (file_exists(G4_DATA_PATH."/item/{$it_id}_l{$i}")) {
$id = $it_id.'_l'.$i;
?>
<li><a href="#" id="<?php echo $it_id; ?>_l<?php echo $i; ?>" class="img_thumb"><img id="large<?php echo $i; ?>" src="<?php echo G4_DATA_URL; ?>/item/<?php echo $it_id; ?>_l<?php echo $i; ?>" alt=""></a></li>
<li><a href="<?php echo G4_SHOP_URL; ?>/largeimage.php?it_id=<?php echo $it_id; ?>&amp;img=<?php echo $id; ?>" id="<?php echo $id; ?>" class="img_thumb"><img id="large<?php echo $i; ?>" src="<?php echo G4_DATA_URL; ?>/item/<?php echo $id; ?>" alt=""></a></li>
<?php
}
}
@ -41,10 +48,16 @@ include_once(G4_PATH.'/head.sub.php');
</div>
<script>
$(function(){ // 이미지 미리보기
$('.img_thumb').bind('hover focus', function(){
var img_src = $(this).attr('id');
$('#sit_pvi_nwbig img').attr('src','<?php echo G4_DATA_URL; ?>/item/'+img_src); // 이미지 소스 교체
$(function(){
// 창 사이즈 조절
var w = <?php echo $size[0]; ?> + 50;
var h = <?php echo $size[1]; ?> + 210;
window.resizeTo(w, h);
// 이미지 미리보기
$(".img_thumb").bind("hover focus", function(){
var img_src = $(this).attr("id");
$("#sit_pvi_nwbig img").attr("src","<?php echo G4_DATA_URL; ?>/item/"+img_src); // 이미지 소스 교체
});
});
</script>