그누보드 Owl Carousel 사용하기
그누보드의 Owl Carousel을 보다 쉽게 사용하기
1. owlcarousel 사용하기위해 그누보드 js 디렉토리에 존재하는 owlcarousel의 js와 css를 추가
[code]
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);
[/code]
2. owlcarousel를 쉽게 사용하기 위해 스크립트 함수 추가
- 스크립트 함수 파일 형태로 추가 - 위치 /js/owlcarousel/load.owl.carousel.js
[code]
jQuery(window).ready(function () {
load_owl_carousel();
});
function load_owl_carousel() {
// OWL CAROUSEL
var _container = jQuery("div.owl-carousel");
if(_container.length > 0) {
_container.each(function() {
var _this = jQuery(this),
_options = _this.attr('data-plugin-options');
_defaults = {
loop: true,
margin: 10,
nav: true,
center: false,
mouseDrag: true,
touchDrag: true,
pullDrag: true,
freeDrag: false,
stagePadding: 0,
merge: false,
mergeFit: true,
autoWidth: false,
startPosition: 0,
URLhashListener: false,
navRewind: true,
navText: [
'<i class="fa fa-angle-left"></i>',
'<i class="fa fa-angle-right"></i>'
],
slideBy: 1,
dots: true,
dotsEach: false,
dotData: false,
lazyLoad: false,
lazyContent: false,
autoplay: false,
autoplayTimeout: 3000,
autoplayHoverPause: false,
smartSpeed: 250,
//fluidSpeed: 'Number',
autoplaySpeed: false,
navSpeed: false,
//dotsSpeed: 'Number/Boolean',
dragEndSpeed: false,
callbacks: true,
responsiveRefreshRate: 200,
responsiveBaseElement: '#wrapper',
responsiveClass: true,
video: false,
videoHeight: false,
videoWidth: false,
animateOut: false,
animateIn: false,
fallbackEasing: 'swing',
info: false,
nestedItemSelector: false,
itemElement: 'div',
navContainer: false,
dotsContainer: false,
animateOut: "slideOutDown",
animateIn: "flipInX",
responsive:{
0:{
items:1
},
600:{
items:2
},
1000:{
items:5
}
}
};
var _config = jQuery.extend({}, _defaults, JSON.parse(_options));
_this.owlCarousel(_config).addClass("owl-loaded");
});
}
}
[/code]
3. 스크립트 함수 load_owl_carousel() 로드
[code]
add_javascript('<script src="'.G5_JS_URL.'/owlcarousel/load.owl.carousel.js"></script>', 10);
[/code]
4. owlcarousel사용
클레스 owl-carousel 추가와 data-plugin-options을 이용해서 owlcarousel사용하시면 되며 사용 예제는 아래를 참고하시면 됩니다.
마지막으로 옵션중 animateIn, animateOut을 사용하기 위해서는 아래 링크를 참고하시면 됩니다.
https://daneden.github.io/animate.css/
- 샘플 -
[code]
<div class="owl-carousel" data-plugin-options='{
"loop": true,
"margin": 10,
"nav": true,
"dots": false,
"center": true,
"slideBy": "1",
"autoplay": true,
"autoplayTimeout": 4500,
"autoWidth": false,
"merge": true,
"rtl": false,
"animateIn": "flipInX",
"animateOut": "flipOutX",
"responsive": {
"0": {"items":1},
"600": {"items":2},
"1000": {"items":2}
}
}'>
<a href="#">
<img style="display:inline-block;width: 100%;" src="1-min.jpg" alt="">
</a>
<a href="#">
<img style="display:inline-block;width: 100%;" src="2-min.jpg" alt="">
</a>
<a href="#">
<img style="display:inline-block;width: 100%;" src="3-min.jpg" alt="">
</a>
<a href="#">
<img style="display:inline-block;width: 100%;" src="4-min.jpg" alt="">
</a>
</div>
[/code]
댓글 4개
게시판 목록
그누보드5 팁자료실
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 공지 | 3년 전 | 4433 | ||
| 2154 | 3년 전 | 3230 | ||
| 2153 | 3년 전 | 2725 | ||
| 2152 |
|
3년 전 | 2592 | |
| 2151 | 3년 전 | 2229 | ||
| 2150 | 3년 전 | 2612 | ||
| 2149 | 3년 전 | 4229 | ||
| 2148 | 3년 전 | 3500 | ||
| 2147 | 3년 전 | 1912 | ||
| 2146 | 3년 전 | 2891 | ||
| 2145 | 3년 전 | 4022 | ||
| 2144 | 3년 전 | 2936 | ||
| 2143 | 3년 전 | 2303 | ||
| 2142 |
welcome
|
3년 전 | 2090 | |
| 2141 | 3년 전 | 2480 | ||
| 2140 |
|
3년 전 | 3481 | |
| 2139 |
|
3년 전 | 3229 | |
| 2138 | 3년 전 | 3249 | ||
| 2137 | 3년 전 | 3013 | ||
| 2136 | 3년 전 | 3137 | ||
| 2135 | 3년 전 | 3751 | ||
| 2134 | 3년 전 | 3309 | ||
| 2133 | 3년 전 | 3464 | ||
| 2132 |
|
3년 전 | 5321 | |
| 2131 | 3년 전 | 2362 | ||
| 2130 | 3년 전 | 3954 | ||
| 2129 |
|
3년 전 | 2949 | |
| 2128 | 3년 전 | 2978 | ||
| 2127 | 3년 전 | 4300 | ||
| 2126 | 3년 전 | 2555 | ||
| 2125 | 3년 전 | 2706 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기