} else {
base.wrapperOuter.css("height", ""); //Else remove height attribute
}
}
if ($currentimg.get(0) !== undefined) {
iterations = 0;
checkImage();
} else {
addHeight();
}
},
completeImg : function (img) {
var naturalWidthType;
if (!img.complete) {
return false;
}
naturalWidthType = typeof img.naturalWidth;
if (naturalWidthType !== "undefined" && img.naturalWidth === 0) {
return false;
}
return true;
},
onVisibleItems : function () {
var base = this,
i;
if (base.options.addClassActive === true) {
base.$owlItems.removeClass("active");
}
base.visibleItems = [];
for (i = base.currentItem; i < base.currentItem + base.options.items; i += 1) {
base.visibleItems.push(i);
if (base.options.addClassActive === true) {
$(base.$owlItems[i]).addClass("active");
}
}
base.owl.visibleItems = base.visibleItems;
},
transitionTypes : function (className) {
var base = this;
//Currently available: "fade", "backSlide", "goDown", "fadeUp"
base.outClass = "owl-" + className + "-out";
base.inClass = "owl-" + className + "-in";
},
singleItemTransition : function () {
var base = this,
outClass = base.outClass,
inClass = base.inClass,
$currentItem = base.$owlItems.eq(base.currentItem),
$prevItem = base.$owlItems.eq(base.prevItem),
prevPos = Math.abs(base.positionsInArray[base.currentItem]) + base.positionsInArray[base.prevItem],
origin = Math.abs(base.positionsInArray[base.currentItem]) + base.itemWidth / 2,
animEnd = 'webkitAnimationEnd oAnimationEnd MSAnimationEnd animationend';
base.isTransition = true;
base.$owlWrapper
.addClass('owl-origin')
.css({
"-webkit-transform-origin" : origin + "px",
"-moz-perspective-origin" : origin + "px",
"perspective-origin" : origin + "px"
});
function transStyles(prevPos) {
return {
"position" : "relative",
"left" : prevPos + "px"
};
}
$prevItem
.css(transStyles(prevPos, 10))
.addClass(outClass)
.on(animEnd, function () {
base.endPrev = true;
$prevItem.off(animEnd);
base.clearTransStyle($prevItem, outClass);
});
$currentItem
.addClass(inClass)
.on(animEnd, function () {
base.endCurrent = true;
$currentItem.off(animEnd);
base.clearTransStyle($currentItem, inClass);
});
},
clearTransStyle : function (item, classToRemove) {
var base = this;
item.css({
"position" : "",
"left" : ""
}).removeClass(classToRemove);
if (base.endPrev && base.endCurrent) {
base.$owlWrapper.removeClass('owl-origin');
base.endPrev = false;
base.endCurrent = false;
base.isTransition = false;
}
},
owlStatus : function () {
var base = this;
base.owl = {
"userOptions" : base.userOptions,
"baseElement" : base.$elem,
"userItems" : base.$userItems,
"owlItems" : base.$owlItems,
"currentItem" : base.currentItem,
"prevItem" : base.prevItem,
"visibleItems" : base.visibleItems,
"isTouch" : base.browser.isTouch,
"browser" : base.browser,
"dragDirection" : base.dragDirection
};
},
clearEvents : function () {
var base = this;
base.$elem.off(".owl owl mousedown.disableTextSelect");
$(document).off(".owl owl");
$(window).off("resize", base.resizer);
},
unWrap : function () {
var base = this;
if (base.$elem.children().length !== 0) {
base.$owlWrapper.unwrap();
base.$userItems.unwrap().unwrap();
if (base.owlControls) {
base.owlControls.remove();
}
}
base.clearEvents();
base.$elem
.attr("style", base.$elem.data("owl-originalStyles") || "")
.attr("class", base.$elem.data("owl-originalClasses"));
},
destroy : function () {
var base = this;
base.stop();
window.clearInterval(base.checkVisible);
base.unWrap();
base.$elem.removeData();
},
reinit : function (newOptions) {
var base = this,
options = $.extend({}, base.userOptions, newOptions);
base.unWrap();
base.init(options, base.$elem);
},
addItem : function (htmlString, targetPosition) {
var base = this,
position;
if (!htmlString) {return false; }
if (base.$elem.children().length === 0) {
base.$elem.append(htmlString);
base.setVars();
return false;
}
base.unWrap();
if (targetPosition === undefined || targetPosition === -1) {
position = -1;
} else {
position = targetPosition;
}
if (position >= base.$userItems.length || position === -1) {
base.$userItems.eq(-1).after(htmlString);
} else {
base.$userItems.eq(position).before(htmlString);
}
base.setVars();
},
removeItem : function (targetPosition) {
var base = this,
position;
if (base.$elem.children().length === 0) {
return false;
}
if (targetPosition === undefined || targetPosition === -1) {
position = -1;
} else {
position = targetPosition;
}
base.unWrap();
base.$userItems.eq(position).remove();
base.setVars();
}
};
$.fn.owlCarousel = function (options) {
return this.each(function () {
if ($(this).data("owl-init") === true) {
return false;
}
$(this).data("owl-init", true);
var carousel = Object.create(Carousel);
carousel.init(options, this);
$.data(this, "owlCarousel", carousel);
});
};
$.fn.owlCarousel.options = {
items : 5,
itemsCustom : false,
itemsDesktop : [1199, 4],
itemsDesktopSmall : [979, 3],
itemsTablet : [768, 2],
itemsTabletSmall : false,
itemsMobile : [479, 1],
singleItem : false,
itemsScaleUp : false,
slideSpeed : 200,
paginationSpeed : 800,
rewindSpeed : 1000,
autoPlay : false,
stopOnHover : false,
navigation : false,
navigationText : ["prev", "next"],
rewindNav : true,
scrollPerPage : false,
pagination : true,
paginationNumbers : false,
responsive : true,
responsiveRefreshRate : 200,
responsiveBaseWidth : window,
baseClass : "owl-carousel",
theme : "owl-theme",
lazyLoad : false,
lazyFollow : true,
lazyEffect : "fade",
autoHeight : false,
jsonPath : false,
jsonSuccess : false,
dragBeforeAnimFinish : true,
mouseDrag : true,
touchDrag : true,
addClassActive : false,
transitionStyle : false,
beforeUpdate : false,
afterUpdate : false,
beforeInit : false,
afterInit : false,
beforeMove : false,
afterMove : false,
afterAction : false,
startDragging : false,
afterLazyLoad: false
};
}(jQuery, window, document));