쇼핑몰: #95 오늘 본 상품 스크롤 완료

This commit is contained in:
whitedot
2013-04-30 14:12:42 +09:00
parent b1ffcaf660
commit e49328d944
3 changed files with 56 additions and 7 deletions

View File

@ -15,10 +15,7 @@ $tv_div['img_length'] = 3; // 한번에 보여줄 이미지 수
<?php if ($tv_idx) { // 오늘 본 상품이 1개라도 있을 때 ?>
<div id="stv_btn">
<button id="up">위</button>
<button id="down">아래</button>
</div>
<div id="stv_btn"></div>
<?php
for ($i=1;$i<=$tv_idx;$i++)
@ -43,6 +40,10 @@ $tv_div['img_length'] = 3; // 한번에 보여줄 이미지 수
$(function() {
var itemQty = <?php echo $tv_idx; ?>; // 총 아이템 수량
var itemShow = <?php echo $tv_div['img_length']; ?>; // 한번에 보여줄 아이템 수량
if (itemQty > itemShow)
{
$('#stv_btn').append('<button id="up">위</button><button id="down">아래</button>');
}
var Flag = 1; // 페이지
var EOFlag = parseInt(<?php echo $i-1; ?>/itemShow); // 전체 리스트를 3(한 번에 보여줄 값)으로 나눠 페이지 최댓값을 구하고
var itemRest = parseInt(<?php echo $i-1; ?>%itemShow); // 나머지 값을 구한 후
@ -74,9 +75,27 @@ $tv_div['img_length'] = 3; // 한번에 보여줄 이미지 수
}
$('#stv_pg').text(Flag+'/'+EOFlag); // 페이지 값 재설정
});
// 위치 고정
var currentPosition = parseInt($("#stv_list").css("top"));
$(window).scroll(function() {
var position = $(window).scrollTop(); // 현재 스크롤바의 위치값을 반환합니다.
if(position > 233){
if($.browser.msie && $.browser.version <= 6){
} else {
$("#stv_list").css('top', '20px');
}
}else{
$('#stv_list').attr('style','');
}
});
});
</script>
<!--[if lte IE 6]>
<script src="<?php echo G4_JS_URL ?>/scroll_oldie.js"></script>
<![endif]-->
<?php } else { // 오늘 본 상품이 없을 때 ?>
<p>없음</p>