此页面为源码效果演示页面

点我返回此源码目录,找同款源码

该演示页暂未关联单独源码文章,先到分类目录里找

Info callback.

Variable Value
items
allItems
currentPosition
currentPage
allPages
autoplay
windowWidth
elWidth
breakpoint

Descripton

'info' option is the only function callback in Owl Carousel 2 and doesnt need to be activated by option callback:true. Can be used to obtain basic information about items/pages/widths etc.

Info function has two parameters. First is object that containes information, second is Owl non jquery object reference.
Note that Item and page positions are zero based values. If you need more specific variables there just let me know.


//Javascript

$('.owl-carousel').owlCarousel({
	items:1,
	loop:true,
	nav:true,
	margin:10,
	info: getInfo,
	responsive:{
		600:{
			items:3
		},			
		960:{
			items:5,
			center:true
		},
		1200:{
			items:6,
			center:false
		}
	}
});

// Insert info into table
function getInfo(i){
	var owlInfo = i,prop,value,name;

	for(prop in owlInfo){
		if(owlInfo.hasOwnProperty(prop)){
			value = owlInfo[prop];
			name = prop;
			$('.'+name).text(value);
		}
	}
}