5.3 버전 내용 적용

This commit is contained in:
thisgun
2018-03-30 18:12:51 +09:00
parent 8c458841d5
commit dc15e1929d
1037 changed files with 49211 additions and 21238 deletions

View File

@ -3,15 +3,22 @@ if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
// add_stylesheet('css 구문', 출력순서); 숫자가 작을 수록 먼저 출력됨
add_stylesheet('<link rel="stylesheet" href="'.G5_SHOP_SKIN_URL.'/style.css">', 0);
add_javascript('<script src="'.G5_JS_URL.'/jquery.bxslider.js"></script>', 10);
?>
<?php
$max_width = $max_height = 0;
$bn_first_class = ' class="sbn_first"';
$bn_first_class = ' class="bn_first"';
$bn_slide_btn = '';
$bn_sl = ' class="bn_sl"';
$main_banners = array();
for ($i=0; $row=sql_fetch_array($result); $i++)
{
if ($i==0) echo '<section id="sbn_idx" class="sbn">'.PHP_EOL.'<h2>쇼핑몰 배너</h2>'.PHP_EOL.'<ul>'.PHP_EOL;
$main_banners[] = $row;
if ($i==0) echo '<div id="main_bn">'.PHP_EOL.'<ul class="slide-wrap">'.PHP_EOL;
//print_r2($row);
// 테두리 있는지
$bn_border = ($row['bn_border']) ? ' class="sbn_border"' : '';;
@ -44,202 +51,39 @@ for ($i=0; $row=sql_fetch_array($result); $i++)
echo '</a>'.PHP_EOL;
echo '</li>'.PHP_EOL;
$bn_first_class = '';
}
}
if ($i>0) echo '</ul>'.PHP_EOL.'</section>'.PHP_EOL;
if ($i > 0) {
echo '</ul>'.PHP_EOL;
echo '<div id="bx_pager" class="bx_pager">
<ul>';
$k = 0;
foreach( $main_banners as $row ){
echo '<li> <a data-slide-index="'.$k.'" href="">'.get_text($row['bn_alt']).'</a></li>'.PHP_EOL;
$k++;
}
echo '</ul>
</div>'.PHP_EOL;
echo '</div>'.PHP_EOL;
?>
<script>
(function($) {
var intervals = {};
var methods = {
init: function(option)
{
if(this.length < 1)
return false;
var $bnnr = this.find("li:has(img)");
var count = $bnnr.size();
var $bnnr_a = $bnnr.find("a");
var width = <?php echo $max_width; ?>;
var height = <?php echo $max_height; ?>;
var wrap_width = this.parent().width();
var c_idx = o_idx = 0;
var el_id = this[0].id;
var $this = this;
if(width > wrap_width) {
height = parseInt(height * (wrap_width / width));
}
width = wrap_width;
this.width(wrap_width).height(height)
.find("ul").width(width).height(height)
.find("li").width(width).height(height);
$bnnr.not(".sbn_first").css("left", width+"px");
$bnnr.each(function() {
var $img = $(this).find("img");
var img_width = parseInt($img.attr("width"));
if(img_width > width)
img_width = width;
$img.removeAttr("width");
$img.width(img_width);
});
// 기본 설정값
var settings = $.extend({
interval: 5000,
duration: 1500
}, option);
if(count > 1) {
var slide_button = "<div id=\"sbn_btn_p\" class=\"sbn_btn\"><button type=\"button\" id=\"sbn_btn_prev\" class=\"sbn_btn_slide\"><span></span>이전</button></div>\n";
slide_button += "<div id=\"sbn_btn_n\" class=\"sbn_btn\"><button type=\"button\" id=\"sbn_btn_next\" class=\"sbn_btn_slide\"><span></span>다음</button></div>";
this.find("ul").before(slide_button);
var $bnnr_btn = this.find(".sbn_btn_slide");
$bnnr_btn.on("focusin", function() {
clear_interval();
});
$bnnr_btn.on("focusout", function() {
set_interval();
});
}
set_interval();
$(".sbn_btn_slide").on("click", function() {
if($this.find(":animated").size() > 0)
return false;
clear_interval();
var id = $(this).attr("id");
if(id.search("prev") > -1) {
right_rolling();
} else {
left_rolling();
}
});
$bnnr.hover(
function() {
clear_interval();
},
function() {
set_interval();
}
);
$bnnr_a.on("focusin", function() {
clear_interval();
});
$bnnr_a.on("focusout", function() {
set_interval();
});
function left_rolling() {
$bnnr.each(function(index) {
if($(this).is(":visible")) {
o_idx = index;
return false;
}
});
$bnnr.not(":visible").css({
display: "none",
left: "+"+width+"px"
});
$bnnr.eq(o_idx).animate(
{ left: "-="+width+"px" }, settings.duration,
function() {
$(this).css("display", "none").css("left", width+"px");
}
);
c_idx = (o_idx + 1) % count;
$bnnr.eq(c_idx).css("display", "block").animate(
{ left: "-="+width+"px" }, settings.duration,
function() {
o_idx = c_idx;
}
);
}
function right_rolling() {
$bnnr.each(function(index) {
if($(this).is(":visible")) {
o_idx = index;
return false;
}
});
$bnnr.not(":visible").css({
display: "none",
left: "-"+width+"px"
});
$bnnr.eq(o_idx).animate(
{ left: "+="+width+"px" }, settings.duration,
function() {
$(this).css("display", "none").css("left", "-"+width+"px");
}
);
c_idx = (o_idx + 1) % count;
$bnnr.eq(c_idx).css("display", "block").animate(
{ left: "+="+width+"px" }, settings.duration,
function() {
o_idx = c_idx;
}
);
}
function set_interval() {
if(count > 1) {
clear_interval();
intervals[el_id] = setInterval(left_rolling, settings.interval);
}
}
function clear_interval() {
if(intervals[el_id]) {
clearInterval(intervals[el_id]);
}
}
},
stop: function()
{
var el_id = this[0].id;
if(intervals[el_id])
clearInterval(intervals[el_id]);
jQuery(function($){
var slider = $('.slide-wrap').show().bxSlider({
speed:800,
pagerCustom: '#bx_pager',
auto: true,
useCSS : false,
onSlideAfter : function(){
slider.startAuto();
}
};
$.fn.bannerRolling = function(option) {
if (methods[option])
return methods[option].apply(this, Array.prototype.slice.call(arguments, 1));
else
return methods.init.apply(this, arguments);
}
}(jQuery));
$(function() {
$("#sbn_idx").bannerRolling();
// 기본 설정값을 변경하려면 아래처럼 사용
//$("#sbn_idx").leftRolling({ interval: 6000, duration: 2000 });
});
});
</script>
</script>
<?php
}
?>