애니메이션 스킨 jQuery 코드 변경

This commit is contained in:
chicpro
2013-08-07 17:48:49 +09:00
parent 4a9dd57d3a
commit 5b342d23f7
4 changed files with 224 additions and 149 deletions

View File

@ -11,8 +11,6 @@ if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
<!-- 상품진열 20 시작 { -->
<?php
$itemtype = $this->type;
for ($i=1; $row=sql_fetch_array($result); $i++) {
$sct_last = '';
if($i>1 && $i%$this->list_mod == 0)
@ -20,9 +18,9 @@ for ($i=1; $row=sql_fetch_array($result); $i++) {
if ($i == 1) {
if ($this->css) {
echo "<ul id=\"smt_{$itemtype}\" class=\"{$this->css}\">\n";
echo "<ul id=\"smt_{$this->type}\" class=\"{$this->css}\">\n";
} else {
echo "<ul id=\"smt_{$itemtype}\" class=\"sct smt_20\">\n";
echo "<ul id=\"smt_{$this->type}\" class=\"sct smt_20\">\n";
}
echo "<li class=\"sct_li sct_li_first\">\n";
}
@ -86,61 +84,83 @@ if($i == 1) echo "<p class=\"sct_noitem\">등록된 상품이 없습니다.</p>\
?>
<script>
$(function() {
var $smt<?php echo $itemtype; ?> = $("#smt_<?php echo $itemtype; ?> li.sct_li");
var $smt<?php echo $itemtype; ?>_a = $("#smt_<?php echo $itemtype; ?> li.sct_li a");
var smt<?php echo $itemtype; ?>_height = $smt<?php echo $itemtype; ?>.closest("ul").height();
var smt<?php echo $itemtype; ?>_count = $smt<?php echo $itemtype; ?>.size();
var smt<?php echo $itemtype; ?>_c_idx = smt<?php echo $itemtype; ?>_o_idx = 0;
var smt<?php echo $itemtype; ?>_time = 5000;
var smt<?php echo $itemtype; ?>_a_time = 800;
var smt<?php echo $itemtype; ?>_interval = null;
$.fn.topRolling = function(option)
{
var $smt = this.find("li.sct_li");
var $smt_a = $smt.find("a");
var height = $smt.closest("ul").height();
var count = $smt.size();
var c_idx = o_idx = 0;
var fx = null;
if(smt<?php echo $itemtype; ?>_count > 1)
smt<?php echo $itemtype; ?>_interval = setInterval(top_rolling, smt<?php echo $itemtype; ?>_time);
// 기본 설정값
var settings = $.extend({
interval: 5000,
duration: 800
}, option);
$smt<?php echo $itemtype; ?>.hover(
if(count < 2)
return;
fx = setInterval(top_rolling, settings.interval);
$smt.hover(
function() {
if(smt<?php echo $itemtype; ?>_interval != null)
clearInterval(smt<?php echo $itemtype; ?>_interval);
if(fx != null)
clearInterval(fx);
},
function() {
if(smt<?php echo $itemtype; ?>_interval != null)
clearInterval(smt<?php echo $itemtype; ?>_interval);
if(fx != null)
clearInterval(fx);
if(smt<?php echo $itemtype; ?>_count > 1)
smt<?php echo $itemtype; ?>_interval = setInterval(top_rolling, smt<?php echo $itemtype; ?>_time);
if(count > 1)
fx = setInterval(top_rolling, settings.interval);
}
);
$smt<?php echo $itemtype; ?>_a.on("focusin", function() {
if(smt<?php echo $itemtype; ?>_interval != null)
clearInterval(smt<?php echo $itemtype; ?>_interval);
$smt_a.on("focusin", function() {
if(fx != null)
clearInterval(fx);
});
$smt<?php echo $itemtype; ?>_a.on("focusout", function() {
if(smt<?php echo $itemtype; ?>_interval != null)
clearInterval(smt<?php echo $itemtype; ?>_interval);
$smt_a.on("focusout", function() {
if(fx != null)
clearInterval(fx);
if(smt<?php echo $itemtype; ?>_count > 1)
smt<?php echo $itemtype; ?>_interval = setInterval(top_rolling, smt<?php echo $itemtype; ?>_time);
if(count > 1)
fx = setInterval(top_rolling, settings.interval);
});
function top_rolling() {
$smt<?php echo $itemtype; ?>.eq(smt<?php echo $itemtype; ?>_o_idx).animate(
{ top: "-="+smt<?php echo $itemtype; ?>_height+"px" }, smt<?php echo $itemtype; ?>_a_time
$smt.each(function(index) {
if($(this).is(":visible")) {
o_idx = index;
return false;
}
});
$smt.eq(o_idx).animate(
{ top: "-="+height+"px" }, settings.duration,
function() {
$(this).css("display", "none").css("top", height+"px");
}
);
smt<?php echo $itemtype; ?>_c_idx = (smt<?php echo $itemtype; ?>_o_idx + 1) % smt<?php echo $itemtype; ?>_count;
c_idx = (o_idx + 1) % count;
$smt<?php echo $itemtype; ?>.eq(smt<?php echo $itemtype; ?>_c_idx).css("display", "block").animate(
{ top: "-="+smt<?php echo $itemtype; ?>_height+"px" }, smt<?php echo $itemtype; ?>_a_time,
$smt.eq(c_idx).css("display", "block").animate(
{ top: "-="+height+"px" }, settings.duration,
function() {
$smt<?php echo $itemtype; ?>.eq(smt<?php echo $itemtype; ?>_o_idx).css("display", "none").css("top", smt<?php echo $itemtype; ?>_height+"px");
smt<?php echo $itemtype; ?>_o_idx = smt<?php echo $itemtype; ?>_c_idx;
o_idx = c_idx;
}
);
}
}
$(function() {
$("#smt_<?php echo $this->type; ?>").topRolling();
// 기본 설정값을 변경하려면 아래처럼 사용
//$("#smt_<?php echo $this->type; ?>").topRolling({ interval: 5000, duration: 800 });
});
</script>
<!-- } 상품진열 20 끝 -->

View File

@ -11,14 +11,12 @@ if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
<!-- 상품유형 30 시작 { -->
<?php
$itemtype = $this->type;
for ($i=1; $row=sql_fetch_array($result); $i++) {
if ($i == 1) {
if ($this->css) {
echo "<ul id=\"smt_{$itemtype}\" class=\"{$this->css}\">\n";
echo "<ul id=\"smt_{$this->type}\" class=\"{$this->css}\">\n";
} else {
echo "<ul id=\"smt_{$itemtype}\" class=\"sct smt_30\">\n";
echo "<ul id=\"smt_{$this->type}\" class=\"sct smt_30\">\n";
}
echo "<li class=\"sct_li sct_li_first\">\n";
}
@ -82,61 +80,83 @@ if($i == 1) echo "<p class=\"sct_noitem\">등록된 상품이 없습니다.</p>\
?>
<script>
$(function() {
var $smt<?php echo $itemtype; ?> = $("#smt_<?php echo $itemtype; ?> li.sct_li");
var $smt<?php echo $itemtype; ?>_a = $("#smt_<?php echo $itemtype; ?> li.sct_li a");
var smt<?php echo $itemtype; ?>_width = $smt<?php echo $itemtype; ?>.width();
var smt<?php echo $itemtype; ?>_count = $smt<?php echo $itemtype; ?>.size();
var smt<?php echo $itemtype; ?>_c_idx = smt<?php echo $itemtype; ?>_o_idx = 0;
var smt<?php echo $itemtype; ?>_time = 7000;
var smt<?php echo $itemtype; ?>_a_time = 1500;
var smt<?php echo $itemtype; ?>_interval = null;
$.fn.leftRolling = function(option)
{
var $smt = this.find("li.sct_li");
var $smt_a = $smt.find("a");
var width = $smt.width();
var count = $smt.size();
var c_idx = smt_o_idx = 0;
var fx = null;
if(smt<?php echo $itemtype; ?>_count > 1)
smt<?php echo $itemtype; ?>_interval = setInterval(left_rolling, smt<?php echo $itemtype; ?>_time);
// 기본 설정값
var settings = $.extend({
interval: 7000,
duration: 1500
}, option);
$smt<?php echo $itemtype; ?>.hover(
if(count < 2)
return;
fx = setInterval(left_rolling, settings.interval);
$smt.hover(
function() {
if(smt<?php echo $itemtype; ?>_interval != null)
clearInterval(smt<?php echo $itemtype; ?>_interval);
if(fx != null)
clearInterval(fx);
},
function() {
if(smt<?php echo $itemtype; ?>_interval != null)
clearInterval(smt<?php echo $itemtype; ?>_interval);
if(fx != null)
clearInterval(fx);
if(smt<?php echo $itemtype; ?>_count > 1)
smt<?php echo $itemtype; ?>_interval = setInterval(left_rolling, smt<?php echo $itemtype; ?>_time);
if(count > 1)
fx = setInterval(left_rolling, settings.interval);
}
);
$smt<?php echo $itemtype; ?>_a.on("focusin", function() {
if(smt<?php echo $itemtype; ?>_interval != null)
clearInterval(smt<?php echo $itemtype; ?>_interval);
$smt_a.on("focusin", function() {
if(smt_interval != null)
clearInterval(smt_interval);
});
$smt<?php echo $itemtype; ?>_a.on("focusout", function() {
if(smt<?php echo $itemtype; ?>_interval != null)
clearInterval(smt<?php echo $itemtype; ?>_interval);
$smt_a.on("focusout", function() {
if(fx != null)
clearInterval(fx);
if(smt<?php echo $itemtype; ?>_count > 1)
smt<?php echo $itemtype; ?>_interval = setInterval(left_rolling, smt<?php echo $itemtype; ?>_time);
if(count > 1)
fx = setInterval(left_rolling, settings.interval);
});
function left_rolling() {
$smt<?php echo $itemtype; ?>.eq(smt<?php echo $itemtype; ?>_o_idx).animate(
{ left: "-="+smt<?php echo $itemtype; ?>_width+"px" }, smt<?php echo $itemtype; ?>_a_time
$smt.each(function(index) {
if($(this).is(":visible")) {
o_idx = index;
return false;
}
});
$smt.eq(o_idx).animate(
{ left: "-="+width+"px" }, settings.duration,
function() {
$(this).css("display", "none").css("left", width+"px");
}
);
smt<?php echo $itemtype; ?>_c_idx = (smt<?php echo $itemtype; ?>_o_idx + 1) % smt<?php echo $itemtype; ?>_count;
c_idx = (o_idx + 1) % count;
$smt<?php echo $itemtype; ?>.eq(smt<?php echo $itemtype; ?>_c_idx).css("display", "block").animate(
{ left: "-="+smt<?php echo $itemtype; ?>_width+"px" }, smt<?php echo $itemtype; ?>_a_time,
$smt.eq(c_idx).css("display", "block").animate(
{ left: "-="+width+"px" }, settings.duration,
function() {
$smt<?php echo $itemtype; ?>.eq(smt<?php echo $itemtype; ?>_o_idx).css("display", "none").css("left", smt<?php echo $itemtype; ?>_width+"px");
smt<?php echo $itemtype; ?>_o_idx = smt<?php echo $itemtype; ?>_c_idx;
o_idx = c_idx;
}
);
}
}
$(function() {
$("#smt_<?php echo $this->type; ?>").leftRolling();
// 기본 설정값을 변경하려면 아래처럼 사용
//$("#smt_<?php echo $this->type; ?>").leftRolling({ interval: 7000, duration: 1500 });
});
</script>
<!-- } 상품진열 30 끝 -->

View File

@ -11,8 +11,6 @@ if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
<!-- 상품진열 40 시작 { -->
<?php
$itemtype = $this->type;
for ($i=1; $row=sql_fetch_array($result); $i++) {
$sct_last = '';
if($i>1 && $i%$this->list_mod == 0)
@ -20,9 +18,9 @@ for ($i=1; $row=sql_fetch_array($result); $i++) {
if ($i == 1) {
if ($this->css) {
echo "<ul id=\"smt_{$itemtype}\" class=\"{$this->css}\">\n";
echo "<ul id=\"smt_{$this->type}\" class=\"{$this->css}\">\n";
} else {
echo "<ul id=\"smt_{$itemtype}\" class=\"sct smt_40\">\n";
echo "<ul id=\"smt_{$this->type}\" class=\"sct smt_40\">\n";
}
echo "<li class=\"sct_li sct_li_first\">\n";
}
@ -86,50 +84,70 @@ if($i == 1) echo "<p class=\"sct_noitem\">등록된 상품이 없습니다.</p>\
?>
<script>
$(function() {
var $smt<?php echo $itemtype; ?> = $("#smt_<?php echo $itemtype; ?> li.sct_li");
var $smt<?php echo $itemtype; ?>_a = $("#smt_<?php echo $itemtype; ?> li.sct_li a");
var smt<?php echo $itemtype; ?>_count = $smt<?php echo $itemtype; ?>.size();
var smt<?php echo $itemtype; ?>_c_idx = smt<?php echo $itemtype; ?>_o_idx = 0;
var smt<?php echo $itemtype; ?>_time = 3000;
var smt<?php echo $itemtype; ?>_interval = null;
$.fn.itemlistShow = function(option)
{
var $smt = this.find("li.sct_li");
var $smt_a = $smt.find("a");
var count = $smt.size();
var c_idx = o_idx = 0;
var fx = null;
if(smt<?php echo $itemtype; ?>_count > 1)
smt<?php echo $itemtype; ?>_interval = setInterval(itemlist_show, smt<?php echo $itemtype; ?>_time);
// 기본 설정값
var settings = $.extend({
interval: 3000
}, option);
$smt<?php echo $itemtype; ?>.hover(
if(count < 2)
return;
fx = setInterval(itemlist_show, settings.interval);
$smt.hover(
function() {
if(smt<?php echo $itemtype; ?>_interval != null)
clearInterval(smt<?php echo $itemtype; ?>_interval);
if(fx != null)
clearInterval(fx);
},
function() {
if(smt<?php echo $itemtype; ?>_interval != null)
clearInterval(smt<?php echo $itemtype; ?>_interval);
if(fx != null)
clearInterval(fx);
if(smt<?php echo $itemtype; ?>_count > 1)
smt<?php echo $itemtype; ?>_interval = setInterval(itemlist_show, smt<?php echo $itemtype; ?>_time);
if(count > 1)
fx = setInterval(itemlist_show, settings.interval);
}
);
$smt<?php echo $itemtype; ?>_a.on("focusin", function() {
if(smt<?php echo $itemtype; ?>_interval != null)
clearInterval(smt<?php echo $itemtype; ?>_interval);
$smt_a.on("focusin", function() {
if(fx != null)
clearInterval(fx);
});
$smt<?php echo $itemtype; ?>_a.on("focusout", function() {
if(smt<?php echo $itemtype; ?>_interval != null)
clearInterval(smt<?php echo $itemtype; ?>_interval);
$smt_a.on("focusout", function() {
if(fx != null)
clearInterval(fx);
if(smt<?php echo $itemtype; ?>_count > 1)
smt<?php echo $itemtype; ?>_interval = setInterval(itemlist_show, smt<?php echo $itemtype; ?>_time);
if(count > 1)
fx = setInterval(itemlist_show, settings.interval);
});
function itemlist_show() {
$smt<?php echo $itemtype; ?>.eq(smt<?php echo $itemtype; ?>_o_idx).css("display", "none");
smt<?php echo $itemtype; ?>_c_idx = (smt<?php echo $itemtype; ?>_o_idx + 1) % smt<?php echo $itemtype; ?>_count;
$smt<?php echo $itemtype; ?>.eq(smt<?php echo $itemtype; ?>_c_idx).css("display", "block");
smt<?php echo $itemtype; ?>_o_idx = smt<?php echo $itemtype; ?>_c_idx;
$smt.each(function(index) {
if($(this).is(":visible")) {
o_idx = index;
return false;
}
});
$smt.eq(o_idx).css("display", "none");
c_idx = (o_idx + 1) % count;
$smt.eq(c_idx).css("display", "block");
o_idx = c_idx;
}
}
$(function() {
$("#smt_<?php echo $this->type; ?>").itemlistShow();
// 기본 설정값을 변경하려면 아래처럼 사용
//$("#smt_<?php echo $this->type; ?>").itemlistShow({ interval: 3000 });
});
</script>
<!-- } 상품진열 40 끝 -->

View File

@ -10,8 +10,6 @@ if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
<!-- 상품진열 50 시작 { -->
<?php
$itemtype = $this->type;
for ($i=1; $row=sql_fetch_array($result); $i++) {
$sct_last = '';
if($i>1 && $i%$this->list_mod == 0)
@ -19,9 +17,9 @@ for ($i=1; $row=sql_fetch_array($result); $i++) {
if ($i == 1) {
if ($this->css) {
echo "<ul id=\"smt_{$itemtype}\" class=\"{$this->css}\">\n";
echo "<ul id=\"smt_{$this->type}\" class=\"{$this->css}\">\n";
} else {
echo "<ul id=\"smt_{$itemtype}\" class=\"sct smt_50\">\n";
echo "<ul id=\"smt_{$this->type}\" class=\"sct smt_50\">\n";
}
echo "<li class=\"sct_li sct_li_first\">\n";
}
@ -85,76 +83,95 @@ if($i == 1) echo "<p class=\"sct_noitem\">등록된 상품이 없습니다.</p>\
?>
<script>
$(function() {
var $smt<?php echo $itemtype; ?> = $("#smt_<?php echo $itemtype; ?> li.sct_li");
var $smt<?php echo $itemtype; ?>_a = $("#smt_<?php echo $itemtype; ?> li.sct_li a");
var smt<?php echo $itemtype; ?>_count = $smt<?php echo $itemtype; ?>.size();
var $smt<?php echo $itemtype; ?>_height = $smt<?php echo $itemtype; ?>.height();
var smt<?php echo $itemtype; ?>_c_idx = smt<?php echo $itemtype; ?>_o_idx = 0;
var smt<?php echo $itemtype; ?>_time = 6000;
var smt<?php echo $itemtype; ?>_a_time = 800;
var smt<?php echo $itemtype; ?>_delay = 300;
var smt<?php echo $itemtype; ?>_interval = null;
$.fn.itemDrop = function(option)
{
var $smt = this.find("li.sct_li");
var $smt_a = $smt.find("a");
var count = $smt.size();
var height = $smt.height();
var c_idx = o_idx = 0;
var fx = null;
var delay = 0;
// 기본 설정값
var settings = $.extend({
interval: 6000,
duration: 800,
delay: 300
}, option);
// 초기실행
if(smt<?php echo $itemtype; ?>_count > 0) {
$smt<?php echo $itemtype; ?>.eq(0).find("div").each(function() {
if(count > 0) {
$smt.eq(0).find("div").each(function() {
$(this).delay(delay).animate(
{ top: "+="+$smt<?php echo $itemtype; ?>_height+"px" }, smt<?php echo $itemtype; ?>_a_time
{ top: "+="+height+"px" }, settings.duration
);
delay += smt<?php echo $itemtype; ?>_delay;
delay += settings.delay;
});
}
if(smt<?php echo $itemtype; ?>_count > 1)
smt<?php echo $itemtype; ?>_interval = setInterval(item_drop, smt<?php echo $itemtype; ?>_time);
if(count > 1)
fx = setInterval(item_drop, settings.interval);
$smt<?php echo $itemtype; ?>.hover(
$smt.hover(
function() {
if(smt<?php echo $itemtype; ?>_interval != null)
clearInterval(smt<?php echo $itemtype; ?>_interval);
if(fx != null)
clearInterval(fx);
},
function() {
if(smt<?php echo $itemtype; ?>_interval != null)
clearInterval(smt<?php echo $itemtype; ?>_interval);
if(fx != null)
clearInterval(fx);
if(smt<?php echo $itemtype; ?>_count > 1)
smt<?php echo $itemtype; ?>_interval = setInterval(item_drop, smt<?php echo $itemtype; ?>_time);
if(count > 1)
fx = setInterval(item_drop, settings.interval);
}
);
$smt<?php echo $itemtype; ?>_a.on("focusin", function() {
if(smt<?php echo $itemtype; ?>_interval != null)
clearInterval(smt<?php echo $itemtype; ?>_interval);
$smt_a.on("focusin", function() {
if(fx != null)
clearInterval(fx);
});
$smt<?php echo $itemtype; ?>_a.on("focusout", function() {
if(smt<?php echo $itemtype; ?>_interval != null)
clearInterval(smt<?php echo $itemtype; ?>_interval);
$smt_a.on("focusout", function() {
if(fx != null)
clearInterval(fx);
if(smt<?php echo $itemtype; ?>_count > 1)
smt<?php echo $itemtype; ?>_interval = setInterval(item_drop, smt<?php echo $itemtype; ?>_time);
if(count > 1)
fx = setInterval(item_drop, settings.interval);
});
function item_drop() {
$smt.each(function(index) {
if($(this).is(":visible")) {
o_idx = index;
return false;
}
});
delay = 0;
$smt<?php echo $itemtype; ?>.eq(smt<?php echo $itemtype; ?>_o_idx).css("display", "none");
$smt<?php echo $itemtype; ?>.eq(smt<?php echo $itemtype; ?>_o_idx).find("div").css("top", "-"+$smt<?php echo $itemtype; ?>_height+"px");
smt<?php echo $itemtype; ?>_c_idx = (smt<?php echo $itemtype; ?>_o_idx + 1) % smt<?php echo $itemtype; ?>_count;
$smt.eq(o_idx).css("display", "none");
$smt.eq(o_idx).find("div").css("top", "-"+height+"px");
$smt<?php echo $itemtype; ?>.eq(smt<?php echo $itemtype; ?>_c_idx).css("display", "block");
$smt<?php echo $itemtype; ?>.eq(smt<?php echo $itemtype; ?>_c_idx).find("div").each(function() {
c_idx = (o_idx + 1) % count;
$smt.eq(c_idx).css("display", "block");
$smt.eq(c_idx).find("div").each(function() {
$(this).delay(delay).animate(
{ top: "+="+$smt<?php echo $itemtype; ?>_height+"px" }, smt<?php echo $itemtype; ?>_a_time
{ top: "+="+height+"px" }, settings.duration
);
delay += smt<?php echo $itemtype; ?>_delay;
delay += settings.delay;
});
smt<?php echo $itemtype; ?>_o_idx = smt<?php echo $itemtype; ?>_c_idx;
o_idx = c_idx;
}
}
$(function() {
$("#smt_<?php echo $this->type; ?>").itemDrop();
// 기본 설정값을 변경하려면 아래처럼 사용
//$("#smt_<?php echo $this->type; ?>").itemDrop({ interval: 6000, duration: 800, delay: 300 });
});
</script>
<!-- } 상품진열 50 끝 -->