");
base.wrapperOuter = base.$elem.find(".owl-wrapper-outer");
base.$elem.css("display", "block");
},
baseClass : function () {
var base = this,
hasBaseClass = base.$elem.hasClass(base.options.baseClass),
hasThemeClass = base.$elem.hasClass(base.options.theme);
if (!hasBaseClass) {
base.$elem.addClass(base.options.baseClass);
}
if (!hasThemeClass) {
base.$elem.addClass(base.options.theme);
}
},
updateItems : function () {
var base = this, width, i;
if (base.options.responsive === false) {
return false;
}
if (base.options.singleItem === true) {
base.options.items = base.orignalItems = 1;
base.options.itemsCustom = false;
base.options.itemsDesktop = false;
base.options.itemsDesktopSmall = false;
base.options.itemsTablet = false;
base.options.itemsTabletSmall = false;
base.options.itemsMobile = false;
return false;
}
width = $(base.options.responsiveBaseWidth).width();
if (width > (base.options.itemsDesktop[0] || base.orignalItems)) {
base.options.items = base.orignalItems;
}
if (base.options.itemsCustom !== false) {
//Reorder array by screen size
base.options.itemsCustom.sort(function (a, b) {return a[0] - b[0]; });
for (i = 0; i < base.options.itemsCustom.length; i += 1) {
if (base.options.itemsCustom[i][0] <= width) {
base.options.items = base.options.itemsCustom[i][1];
}
}
} else {
if (width <= base.options.itemsDesktop[0] && base.options.itemsDesktop !== false) {
base.options.items = base.options.itemsDesktop[1];
}
if (width <= base.options.itemsDesktopSmall[0] && base.options.itemsDesktopSmall !== false) {
base.options.items = base.options.itemsDesktopSmall[1];
}
if (width <= base.options.itemsTablet[0] && base.options.itemsTablet !== false) {
base.options.items = base.options.itemsTablet[1];
}
if (width <= base.options.itemsTabletSmall[0] && base.options.itemsTabletSmall !== false) {
base.options.items = base.options.itemsTabletSmall[1];
}
if (width <= base.options.itemsMobile[0] && base.options.itemsMobile !== false) {
base.options.items = base.options.itemsMobile[1];
}
}
//if number of items is less than declared
if (base.options.items > base.itemsAmount && base.options.itemsScaleUp === true) {
base.options.items = base.itemsAmount;
}
},
response : function () {
var base = this,
smallDelay,
lastWindowWidth;
if (base.options.responsive !== true) {
return false;
}
lastWindowWidth = $(window).width();
base.resizer = function () {
if ($(window).width() !== lastWindowWidth) {
if (base.options.autoPlay !== false) {
window.clearInterval(base.autoPlayInterval);
}
window.clearTimeout(smallDelay);
smallDelay = window.setTimeout(function () {
lastWindowWidth = $(window).width();
base.updateVars();
}, base.options.responsiveRefreshRate);
}
};
$(window).resize(base.resizer);
},
updatePosition : function () {
var base = this;
base.jumpTo(base.currentItem);
if (base.options.autoPlay !== false) {
base.checkAp();
}
},
appendItemsSizes : function () {
var base = this,
roundPages = 0,
lastItem = base.itemsAmount - base.options.items;
base.$owlItems.each(function (index) {
var $this = $(this);
$this
.css({"width": base.itemWidth})
.data("owl-item", Number(index));
if (index % base.options.items === 0 || index === lastItem) {
if (!(index > lastItem)) {
roundPages += 1;
}
}
$this.data("owl-roundPages", roundPages);
});
},
appendWrapperSizes : function () {
var base = this,
width = base.$owlItems.length * base.itemWidth;
base.$owlWrapper.css({
"width": width * 2,
"left": 0
});
base.appendItemsSizes();
},
calculateAll : function () {
var base = this;
base.calculateWidth();
base.appendWrapperSizes();
base.loops();
base.max();
},
calculateWidth : function () {
var base = this;
base.itemWidth = Math.round(base.$elem.width() / base.options.items);
},
max : function () {
var base = this,
maximum = ((base.itemsAmount * base.itemWidth) - base.options.items * base.itemWidth) * -1;
if (base.options.items > base.itemsAmount) {
base.maximumItem = 0;
maximum = 0;
base.maximumPixels = 0;
} else {
base.maximumItem = base.itemsAmount - base.options.items;
base.maximumPixels = maximum;
}
return maximum;
},
min : function () {
return 0;
},
loops : function () {
var base = this,
prev = 0,
elWidth = 0,
i,
item,
roundPageNum;
base.positionsInArray = [0];
base.pagesInArray = [];
for (i = 0; i < base.itemsAmount; i += 1) {
elWidth += base.itemWidth;
base.positionsInArray.push(-elWidth);
if (base.options.scrollPerPage === true) {
item = $(base.$owlItems[i]);
roundPageNum = item.data("owl-roundPages");
if (roundPageNum !== prev) {
base.pagesInArray[prev] = base.positionsInArray[i];
prev = roundPageNum;
}
}
}
},
buildControls : function () {
var base = this;
if (base.options.navigation === true || base.options.pagination === true) {
base.owlControls = $("
").toggleClass("clickable", !base.browser.isTouch).appendTo(base.$elem);
}
if (base.options.pagination === true) {
base.buildPagination();
}
if (base.options.navigation === true) {
base.buildButtons();
}
},
buildButtons : function () {
var base = this,
buttonsWrapper = $("