영카트 5.4 버전 내용 적용
This commit is contained in:
@ -3,18 +3,20 @@ if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
|
||||
|
||||
// add_stylesheet('css 구문', 출력순서); 숫자가 작을 수록 먼저 출력됨
|
||||
add_stylesheet('<link rel="stylesheet" href="'.G5_MSHOP_SKIN_URL.'/style.css">', 0);
|
||||
add_stylesheet('<link rel="stylesheet" href="'.G5_JS_URL.'/swiper/swiper.min.css">', 0);
|
||||
add_javascript('<script src="'.G5_JS_URL.'/swiper/swiper.min.js"></script>', 10);
|
||||
?>
|
||||
add_javascript('<script src="'.G5_JS_URL.'/owlcarousel/owl.carousel.min.js"></script>', 10);
|
||||
add_stylesheet('<link rel="stylesheet" href="'.G5_JS_URL.'/owlcarousel/owl.carousel.min.css">', 10);
|
||||
|
||||
<?php
|
||||
$max_width = $max_height = 0;
|
||||
$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 '<div id="main_bn" class="swiper-container">'.PHP_EOL.'<div class="swiper-wrapper">'.PHP_EOL;
|
||||
$main_banners[] = $row;
|
||||
|
||||
if ($i==0) echo '<div id="main_bn"><div class="main_banner_owl owl-carousel">'.PHP_EOL;
|
||||
//print_r2($row);
|
||||
// 테두리 있는지
|
||||
$bn_border = ($row['bn_border']) ? ' class="sbn_border"' : '';;
|
||||
@ -36,7 +38,7 @@ for ($i=0; $row=sql_fetch_array($result); $i++)
|
||||
if($max_height < $size[1])
|
||||
$max_height = $size[1];
|
||||
|
||||
echo '<div class="swiper-slide">'.PHP_EOL;
|
||||
echo '<div class="item">';
|
||||
if ($row['bn_url'][0] == '#')
|
||||
$banner .= '<a href="'.$row['bn_url'].'">';
|
||||
else if ($row['bn_url'] && $row['bn_url'] != 'http://') {
|
||||
@ -45,32 +47,72 @@ for ($i=0; $row=sql_fetch_array($result); $i++)
|
||||
echo $banner.'<img src="'.G5_DATA_URL.'/banner/'.$row['bn_id'].'" width="'.$size[0].'" alt="'.get_text($row['bn_alt']).'"'.$bn_border.'>';
|
||||
if($banner)
|
||||
echo '</a>'.PHP_EOL;
|
||||
echo '</div>'.PHP_EOL;
|
||||
|
||||
$bn_sl = '';
|
||||
echo '</div>';
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if ($i > 0) {
|
||||
echo '</div>'.PHP_EOL;
|
||||
|
||||
echo '<div class="swiper-pagination"></div>'.PHP_EOL;
|
||||
|
||||
echo '</div>'.PHP_EOL;
|
||||
|
||||
echo '<div class="btn_wr"><a href="#" class="pager-prev"><i class="fa fa-angle-left"></i></a><div id="slide-counter"></div><a href="#" class="pager-next"><i class="fa fa-angle-right"></i></a> </div>'.PHP_EOL;
|
||||
echo '</div>'.PHP_EOL;
|
||||
?>
|
||||
|
||||
|
||||
<script>
|
||||
jQuery(function($){
|
||||
var swiper = new Swiper('#main_bn', {
|
||||
slidesPerView: 1,
|
||||
spaceBetween: 0,
|
||||
loop: true,
|
||||
autoplay: {delay: 100000, disableOnInteraction:false},
|
||||
pagination: {el: '.swiper-pagination', clickable: true}
|
||||
function owl_show_page(event){
|
||||
|
||||
if (event.item) {
|
||||
var count = event.item.count,
|
||||
item_index = event.item.index,
|
||||
index = 1;
|
||||
|
||||
if( is_loop ){
|
||||
index = ( 1 + ( event.property.value - Math.ceil( event.item.count / 2 ) ) % event.item.count || 0 ) || 1;
|
||||
} else {
|
||||
index = event.item.index ? event.item.index + 1 : 1;
|
||||
}
|
||||
|
||||
$(event.target).next(".btn_wr").find(".slide-index").text(index);
|
||||
}
|
||||
}
|
||||
|
||||
var is_loop = true,
|
||||
item_totals = $('.main_banner_owl .item').length;
|
||||
|
||||
if( item_totals ){
|
||||
$('#slide-counter').prepend('<strong class="slide-index current-index"></strong> / ')
|
||||
.append('<span class="total-slides">'+item_totals+'</span>');
|
||||
}
|
||||
|
||||
var owl = $('.main_banner_owl').owlCarousel({
|
||||
items:1,
|
||||
loop:is_loop,
|
||||
margin:0,
|
||||
nav:false,
|
||||
autoHeight:true,
|
||||
autoplay:true,
|
||||
autoplayTimeout:5000, // 5000은 5초
|
||||
autoplayHoverPause:true,
|
||||
dots:false,
|
||||
onChanged:function(event){
|
||||
owl_show_page(event);
|
||||
},
|
||||
});
|
||||
|
||||
$(document).on("click", ".btn_wr .pager-next", function(e){
|
||||
e.preventDefault();
|
||||
owl.trigger('next.owl.carousel');
|
||||
});
|
||||
|
||||
$(document).on("click", ".btn_wr .pager-prev", function(e){
|
||||
e.preventDefault();
|
||||
owl.trigger('prev.owl.carousel');
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user