/* * jquery owlcarousel v1.3.3 */ if (typeof object.create !== "function") { object.create = function (obj) { function f() {} f.prototype = obj; return new f(); }; } (function ($, window, document) { var carousel = { init : function (options, el) { var base = this; base.$elem = $(el); base.options = $.extend({}, $.fn.owlcarousel.options, base.$elem.data(), options); base.useroptions = options; base.loadcontent(); }, loadcontent : function () { var base = this, url; function getdata(data) { var i, content = ""; if (typeof base.options.jsonsuccess === "function") { base.options.jsonsuccess.apply(this, [data]); } else { for (i in data.owl) { if (data.owl.hasownproperty(i)) { content += data.owl[i].item; } } base.$elem.html(content); } base.login(); } if (typeof base.options.beforeinit === "function") { base.options.beforeinit.apply(this, [base.$elem]); } if (typeof base.options.jsonpath === "string") { url = base.options.jsonpath; $.getjson(url, getdata); } else { base.login(); } }, login : function () { var base = this; base.$elem.data("owl-originalstyles", base.$elem.attr("style")); base.$elem.data("owl-originalclasses", base.$elem.attr("class")); base.$elem.css({opacity: 0}); base.orignalitems = base.options.items; base.checkbrowser(); base.wrapperwidth = 0; base.checkvisible = null; base.setvars(); }, setvars : function () { var base = this; if (base.$elem.children().length === 0) {return false; } base.baseclass(); base.eventtypes(); base.$useritems = base.$elem.children(); base.itemsamount = base.$useritems.length; base.wrapitems(); base.$owlitems = base.$elem.find(".owl-item"); base.$owlwrapper = base.$elem.find(".owl-wrapper"); base.playdirection = "next"; base.previtem = 0; base.prevarr = [0]; base.currentitem = 0; base.customevents(); base.onstartup(); }, onstartup : function () { var base = this; base.updateitems(); base.calculateall(); base.buildcontrols(); base.updatecontrols(); base.response(); base.moveevents(); base.stoponhover(); base.owlstatus(); if (base.options.transitionstyle !== false) { base.transitiontypes(base.options.transitionstyle); } if (base.options.autoplay === true) { base.options.autoplay = 5000; } base.play(); base.$elem.find(".owl-wrapper").css("display", "block"); if (!base.$elem.is(":visible")) { base.watchvisibility(); } else { base.$elem.css("opacity", 1); } base.onstartup = false; base.eachmoveupdate(); if (typeof base.options.afterinit === "function") { base.options.afterinit.apply(this, [base.$elem]); } }, eachmoveupdate : function () { var base = this; if (base.options.lazyload === true) { base.lazyload(); } if (base.options.autoheight === true) { base.autoheight(); } base.onvisibleitems(); if (typeof base.options.afteraction === "function") { base.options.afteraction.apply(this, [base.$elem]); } }, updatevars : function () { var base = this; if (typeof base.options.beforeupdate === "function") { base.options.beforeupdate.apply(this, [base.$elem]); } base.watchvisibility(); base.updateitems(); base.calculateall(); base.updateposition(); base.updatecontrols(); base.eachmoveupdate(); if (typeof base.options.afterupdate === "function") { base.options.afterupdate.apply(this, [base.$elem]); } }, reload : function () { var base = this; window.settimeout(function () { base.updatevars(); }, 0); }, watchvisibility : function () { var base = this; if (base.$elem.is(":visible") === false) { base.$elem.css({opacity: 0}); window.clearinterval(base.autoplayinterval); window.clearinterval(base.checkvisible); } else { return false; } base.checkvisible = window.setinterval(function () { if (base.$elem.is(":visible")) { base.reload(); base.$elem.animate({opacity: 1}, 200); window.clearinterval(base.checkvisible); } }, 500); }, wrapitems : function () { var base = this; base.$useritems.wrapall("
").wrap("
"); base.$elem.find(".owl-wrapper").wrap("
"); 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 = $("
"); base.owlcontrols.append(buttonswrapper); base.buttonprev = $("
", { "class" : "owl-prev", "html" : base.options.navigationtext[0] || "" }); base.buttonnext = $("
", { "class" : "owl-next", "html" : base.options.navigationtext[1] || "" }); buttonswrapper .append(base.buttonprev) .append(base.buttonnext); buttonswrapper.on("touchstart.owlcontrols mousedown.owlcontrols", "div[class^=\"owl\"]", function (event) { event.preventdefault(); }); buttonswrapper.on("touchend.owlcontrols mouseup.owlcontrols", "div[class^=\"owl\"]", function (event) { event.preventdefault(); if ($(this).hasclass("owl-next")) { base.next(); } else { base.prev(); } }); }, buildpagination : function () { var base = this; base.paginationwrapper = $("
"); base.owlcontrols.append(base.paginationwrapper); base.paginationwrapper.on("touchend.owlcontrols mouseup.owlcontrols", ".owl-page", function (event) { event.preventdefault(); if (number($(this).data("owl-page")) !== base.currentitem) { base.goto(number($(this).data("owl-page")), true); } }); }, updatepagination : function () { var base = this, counter, lastpage, lastitem, i, paginationbutton, paginationbuttoninner; if (base.options.pagination === false) { return false; } base.paginationwrapper.html(""); counter = 0; lastpage = base.itemsamount - base.itemsamount % base.options.items; for (i = 0; i < base.itemsamount; i += 1) { if (i % base.options.items === 0) { counter += 1; if (lastpage === i) { lastitem = base.itemsamount - base.options.items; } paginationbutton = $("
", { "class" : "owl-page" }); paginationbuttoninner = $("", { "text": base.options.paginationnumbers === true ? counter : "", "class": base.options.paginationnumbers === true ? "owl-numbers" : "" }); paginationbutton.append(paginationbuttoninner); paginationbutton.data("owl-page", lastpage === i ? lastitem : i); paginationbutton.data("owl-roundpages", counter); base.paginationwrapper.append(paginationbutton); } } base.checkpagination(); }, checkpagination : function () { var base = this; if (base.options.pagination === false) { return false; } base.paginationwrapper.find(".owl-page").each(function () { if ($(this).data("owl-roundpages") === $(base.$owlitems[base.currentitem]).data("owl-roundpages")) { base.paginationwrapper .find(".owl-page") .removeclass("active"); $(this).addclass("active"); } }); }, checknavigation : function () { var base = this; if (base.options.navigation === false) { return false; } if (base.options.rewindnav === false) { if (base.currentitem === 0 && base.maximumitem === 0) { base.buttonprev.addclass("disabled"); base.buttonnext.addclass("disabled"); } else if (base.currentitem === 0 && base.maximumitem !== 0) { base.buttonprev.addclass("disabled"); base.buttonnext.removeclass("disabled"); } else if (base.currentitem === base.maximumitem) { base.buttonprev.removeclass("disabled"); base.buttonnext.addclass("disabled"); } else if (base.currentitem !== 0 && base.currentitem !== base.maximumitem) { base.buttonprev.removeclass("disabled"); base.buttonnext.removeclass("disabled"); } } }, updatecontrols : function () { var base = this; base.updatepagination(); base.checknavigation(); if (base.owlcontrols) { if (base.options.items >= base.itemsamount) { base.owlcontrols.hide(); } else { base.owlcontrols.show(); } } }, destroycontrols : function () { var base = this; if (base.owlcontrols) { base.owlcontrols.remove(); } }, next : function (speed) { var base = this; if (base.istransition) { return false; } base.currentitem += base.options.scrollperpage === true ? base.options.items : 1; if (base.currentitem > base.maximumitem + (base.options.scrollperpage === true ? (base.options.items - 1) : 0)) { if (base.options.rewindnav === true) { base.currentitem = 0; speed = "rewind"; } else { base.currentitem = base.maximumitem; return false; } } base.goto(base.currentitem, speed); }, prev : function (speed) { var base = this; if (base.istransition) { return false; } if (base.options.scrollperpage === true && base.currentitem > 0 && base.currentitem < base.options.items) { base.currentitem = 0; } else { base.currentitem -= base.options.scrollperpage === true ? base.options.items : 1; } if (base.currentitem < 0) { if (base.options.rewindnav === true) { base.currentitem = base.maximumitem; speed = "rewind"; } else { base.currentitem = 0; return false; } } base.goto(base.currentitem, speed); }, goto : function (position, speed, drag) { var base = this, gotopixel; if (base.istransition) { return false; } if (typeof base.options.beforemove === "function") { base.options.beforemove.apply(this, [base.$elem]); } if (position >= base.maximumitem) { position = base.maximumitem; } else if (position <= 0) { position = 0; } base.currentitem = base.owl.currentitem = position; if (base.options.transitionstyle !== false && drag !== "drag" && base.options.items === 1 && base.browser.support3d === true) { base.swapspeed(0); if (base.browser.support3d === true) { base.transition3d(base.positionsinarray[position]); } else { base.css2slide(base.positionsinarray[position], 1); } base.aftergo(); base.singleitemtransition(); return false; } gotopixel = base.positionsinarray[position]; if (base.browser.support3d === true) { base.iscss3finish = false; if (speed === true) { base.swapspeed("paginationspeed"); window.settimeout(function () { base.iscss3finish = true; }, base.options.paginationspeed); } else if (speed === "rewind") { base.swapspeed(base.options.rewindspeed); window.settimeout(function () { base.iscss3finish = true; }, base.options.rewindspeed); } else { base.swapspeed("slidespeed"); window.settimeout(function () { base.iscss3finish = true; }, base.options.slidespeed); } base.transition3d(gotopixel); } else { if (speed === true) { base.css2slide(gotopixel, base.options.paginationspeed); } else if (speed === "rewind") { base.css2slide(gotopixel, base.options.rewindspeed); } else { base.css2slide(gotopixel, base.options.slidespeed); } } base.aftergo(); }, jumpto : function (position) { var base = this; if (typeof base.options.beforemove === "function") { base.options.beforemove.apply(this, [base.$elem]); } if (position >= base.maximumitem || position === -1) { position = base.maximumitem; } else if (position <= 0) { position = 0; } base.swapspeed(0); if (base.browser.support3d === true) { base.transition3d(base.positionsinarray[position]); } else { base.css2slide(base.positionsinarray[position], 1); } base.currentitem = base.owl.currentitem = position; base.aftergo(); }, aftergo : function () { var base = this; base.prevarr.push(base.currentitem); base.previtem = base.owl.previtem = base.prevarr[base.prevarr.length - 2]; base.prevarr.shift(0); if (base.previtem !== base.currentitem) { base.checkpagination(); base.checknavigation(); base.eachmoveupdate(); if (base.options.autoplay !== false) { base.checkap(); } } if (typeof base.options.aftermove === "function" && base.previtem !== base.currentitem) { base.options.aftermove.apply(this, [base.$elem]); } }, stop : function () { var base = this; base.apstatus = "stop"; window.clearinterval(base.autoplayinterval); }, checkap : function () { var base = this; if (base.apstatus !== "stop") { base.play(); } }, play : function () { var base = this; base.apstatus = "play"; if (base.options.autoplay === false) { return false; } window.clearinterval(base.autoplayinterval); base.autoplayinterval = window.setinterval(function () { base.next(true); }, base.options.autoplay); }, swapspeed : function (action) { var base = this; if (action === "slidespeed") { base.$owlwrapper.css(base.addcssspeed(base.options.slidespeed)); } else if (action === "paginationspeed") { base.$owlwrapper.css(base.addcssspeed(base.options.paginationspeed)); } else if (typeof action !== "string") { base.$owlwrapper.css(base.addcssspeed(action)); } }, addcssspeed : function (speed) { return { "-webkit-transition": "all " + speed + "ms ease", "-moz-transition": "all " + speed + "ms ease", "-o-transition": "all " + speed + "ms ease", "transition": "all " + speed + "ms ease" }; }, removetransition : function () { return { "-webkit-transition": "", "-moz-transition": "", "-o-transition": "", "transition": "" }; }, dotranslate : function (pixels) { return { "-webkit-transform": "translate3d(" + pixels + "px, 0px, 0px)", "-moz-transform": "translate3d(" + pixels + "px, 0px, 0px)", "-o-transform": "translate3d(" + pixels + "px, 0px, 0px)", "-ms-transform": "translate3d(" + pixels + "px, 0px, 0px)", "transform": "translate3d(" + pixels + "px, 0px,0px)" }; }, transition3d : function (value) { var base = this; base.$owlwrapper.css(base.dotranslate(value)); }, css2move : function (value) { var base = this; base.$owlwrapper.css({"left" : value}); }, css2slide : function (value, speed) { var base = this; base.iscssfinish = false; base.$owlwrapper.stop(true, true).animate({ "left" : value }, { duration : speed || base.options.slidespeed, complete : function () { base.iscssfinish = true; } }); }, checkbrowser : function () { var base = this, translate3d = "translate3d(0px, 0px, 0px)", tempelem = document.createelement("div"), regex, assupport, support3d, istouch; tempelem.style.csstext = " -moz-transform:" + translate3d + "; -ms-transform:" + translate3d + "; -o-transform:" + translate3d + "; -webkit-transform:" + translate3d + "; transform:" + translate3d; regex = /translate3d\(0px, 0px, 0px\)/g; assupport = tempelem.style.csstext.match(regex); support3d = (assupport !== null && assupport.length === 1); istouch = "ontouchstart" in window || window.navigator.msmaxtouchpoints; base.browser = { "support3d" : support3d, "istouch" : istouch }; }, moveevents : function () { var base = this; if (base.options.mousedrag !== false || base.options.touchdrag !== false) { base.gestures(); base.disabledevents(); } }, eventtypes : function () { var base = this, types = ["s", "e", "x"]; base.ev_types = {}; if (base.options.mousedrag === true && base.options.touchdrag === true) { types = [ "touchstart.owl mousedown.owl", "touchmove.owl mousemove.owl", "touchend.owl touchcancel.owl mouseup.owl" ]; } else if (base.options.mousedrag === false && base.options.touchdrag === true) { types = [ "touchstart.owl", "touchmove.owl", "touchend.owl touchcancel.owl" ]; } else if (base.options.mousedrag === true && base.options.touchdrag === false) { types = [ "mousedown.owl", "mousemove.owl", "mouseup.owl" ]; } base.ev_types.start = types[0]; base.ev_types.move = types[1]; base.ev_types.end = types[2]; }, disabledevents : function () { var base = this; base.$elem.on("dragstart.owl", function (event) { event.preventdefault(); }); base.$elem.on("mousedown.disabletextselect", function (e) { return $(e.target).is('input, textarea, select, option'); }); }, gestures : function () { /*jslint unparam: true*/ var base = this, locals = { offsetx : 0, offsety : 0, baseelwidth : 0, relativepos : 0, position: null, minswipe : null, maxswipe: null, sliding : null, dargging: null, targetelement : null }; base.iscssfinish = true; function gettouches(event) { if (event.touches !== undefined) { return { x : event.touches[0].pagex, y : event.touches[0].pagey }; } if (event.touches === undefined) { if (event.pagex !== undefined) { return { x : event.pagex, y : event.pagey }; } if (event.pagex === undefined) { return { x : event.clientx, y : event.clienty }; } } } function swapevents(type) { if (type === "on") { $(document).on(base.ev_types.move, dragmove); $(document).on(base.ev_types.end, dragend); } else if (type === "off") { $(document).off(base.ev_types.move); $(document).off(base.ev_types.end); } } function dragstart(event) { var ev = event.originalevent || event || window.event, position; if (ev.which === 3) { return false; } if (base.itemsamount <= base.options.items) { return; } if (base.iscssfinish === false && !base.options.dragbeforeanimfinish) { return false; } if (base.iscss3finish === false && !base.options.dragbeforeanimfinish) { return false; } if (base.options.autoplay !== false) { window.clearinterval(base.autoplayinterval); } if (base.browser.istouch !== true && !base.$owlwrapper.hasclass("grabbing")) { base.$owlwrapper.addclass("grabbing"); } base.newposx = 0; base.newrelativex = 0; $(this).css(base.removetransition()); position = $(this).position(); locals.relativepos = position.left; locals.offsetx = gettouches(ev).x - position.left; locals.offsety = gettouches(ev).y - position.top; swapevents("on"); locals.sliding = false; locals.targetelement = ev.target || ev.srcelement; } function dragmove(event) { var ev = event.originalevent || event || window.event, minswipe, maxswipe; base.newposx = gettouches(ev).x - locals.offsetx; base.newposy = gettouches(ev).y - locals.offsety; base.newrelativex = base.newposx - locals.relativepos; if (typeof base.options.startdragging === "function" && locals.dragging !== true && base.newrelativex !== 0) { locals.dragging = true; base.options.startdragging.apply(base, [base.$elem]); } if ((base.newrelativex > 8 || base.newrelativex < -8) && (base.browser.istouch === true)) { if (ev.preventdefault !== undefined) { ev.preventdefault(); } else { ev.returnvalue = false; } locals.sliding = true; } if ((base.newposy > 10 || base.newposy < -10) && locals.sliding === false) { $(document).off("touchmove.owl"); } minswipe = function () { return base.newrelativex / 5; }; maxswipe = function () { return base.maximumpixels + base.newrelativex / 5; }; base.newposx = math.max(math.min(base.newposx, minswipe()), maxswipe()); if (base.browser.support3d === true) { base.transition3d(base.newposx); } else { base.css2move(base.newposx); } } function dragend(event) { var ev = event.originalevent || event || window.event, newposition, handlers, owlstopevent; ev.target = ev.target || ev.srcelement; locals.dragging = false; if (base.browser.istouch !== true) { base.$owlwrapper.removeclass("grabbing"); } if (base.newrelativex < 0) { base.dragdirection = base.owl.dragdirection = "left"; } else { base.dragdirection = base.owl.dragdirection = "right"; } if (base.newrelativex !== 0) { newposition = base.getnewposition(); base.goto(newposition, false, "drag"); if (locals.targetelement === ev.target && base.browser.istouch !== true) { $(ev.target).on("click.disable", function (ev) { ev.stopimmediatepropagation(); ev.stoppropagation(); ev.preventdefault(); $(ev.target).off("click.disable"); }); handlers = $._data(ev.target, "events").click; owlstopevent = handlers.pop(); handlers.splice(0, 0, owlstopevent); } } swapevents("off"); } base.$elem.on(base.ev_types.start, ".owl-wrapper", dragstart); }, getnewposition : function () { var base = this, newposition = base.closestitem(); if (newposition > base.maximumitem) { base.currentitem = base.maximumitem; newposition = base.maximumitem; } else if (base.newposx >= 0) { newposition = 0; base.currentitem = 0; } return newposition; }, closestitem : function () { var base = this, array = base.options.scrollperpage === true ? base.pagesinarray : base.positionsinarray, goal = base.newposx, closest = null; $.each(array, function (i, v) { if (goal - (base.itemwidth / 20) > array[i + 1] && goal - (base.itemwidth / 20) < v && base.movedirection() === "left") { closest = v; if (base.options.scrollperpage === true) { base.currentitem = $.inarray(closest, base.positionsinarray); } else { base.currentitem = i; } } else if (goal + (base.itemwidth / 20) < v && goal + (base.itemwidth / 20) > (array[i + 1] || array[i] - base.itemwidth) && base.movedirection() === "right") { if (base.options.scrollperpage === true) { closest = array[i + 1] || array[array.length - 1]; base.currentitem = $.inarray(closest, base.positionsinarray); } else { closest = array[i + 1]; base.currentitem = i + 1; } } }); return base.currentitem; }, movedirection : function () { var base = this, direction; if (base.newrelativex < 0) { direction = "right"; base.playdirection = ""; } else { direction = "left"; base.playdirection = ""; } return direction; }, customevents : function () { /*jslint unparam: true*/ var base = this; base.$elem.on("owl.next", function () { base.next(); }); base.$elem.on("owl.prev", function () { base.prev(); }); base.$elem.on("owl.play", function (event, speed) { base.options.autoplay = speed; base.play(); base.hoverstatus = "play"; }); base.$elem.on("owl.stop", function () { base.stop(); base.hoverstatus = "stop"; }); base.$elem.on("owl.goto", function (event, item) { base.goto(item); }); base.$elem.on("owl.jumpto", function (event, item) { base.jumpto(item); }); }, stoponhover : function () { var base = this; if (base.options.stoponhover === true && base.browser.istouch !== true && base.options.autoplay !== false) { base.$elem.on("mouseover", function () { base.stop(); }); base.$elem.on("mouseout", function () { if (base.hoverstatus !== "stop") { base.play(); } }); } }, lazyload : function () { var base = this, i, $item, itemnumber, $lazyimg, follow; if (base.options.lazyload === false) { return false; } for (i = 0; i < base.itemsamount; i += 1) { $item = $(base.$owlitems[i]); if ($item.data("owl-loaded") === "loaded") { continue; } itemnumber = $item.data("owl-item"); $lazyimg = $item.find(".lazyowl"); if (typeof $lazyimg.data("src") !== "string") { $item.data("owl-loaded", "loaded"); continue; } if ($item.data("owl-loaded") === undefined) { $lazyimg.hide(); $item.addclass("loading").data("owl-loaded", "checked"); } if (base.options.lazyfollow === true) { follow = itemnumber >= base.currentitem; } else { follow = true; } if (follow && itemnumber < base.currentitem + base.options.items && $lazyimg.length) { base.lazypreload($item, $lazyimg); } } }, lazypreload : function ($item, $lazyimg) { var base = this, iterations = 0, isbackgroundimg; if ($lazyimg.prop("tagname") === "div") { $lazyimg.css("background-image", "url(" + $lazyimg.data("src") + ")"); isbackgroundimg = true; } else { $lazyimg[0].src = $lazyimg.data("src"); } function showimage() { $item.data("owl-loaded", "loaded").removeclass("loading"); $lazyimg.removeattr("data-src"); if (base.options.lazyeffect === "fade") { $lazyimg.fadein(400); } else { $lazyimg.show(); } if (typeof base.options.afterlazyload === "function") { base.options.afterlazyload.apply(this, [base.$elem]); } } function checklazyimage() { iterations += 1; if (base.completeimg($lazyimg.get(0)) || isbackgroundimg === true) { showimage(); } else if (iterations <= 100) {//if image loads in less than 10 seconds window.settimeout(checklazyimage, 100); } else { showimage(); } } checklazyimage(); }, autoheight : function () { var base = this, $currentimg = $(base.$owlitems[base.currentitem]).find("img"), iterations; function addheight() { var $currentitem = $(base.$owlitems[base.currentitem]).height(); base.wrapperouter.css("height", $currentitem + "px"); if (!base.wrapperouter.hasclass("autoheight")) { window.settimeout(function () { base.wrapperouter.addclass("autoheight"); }, 0); } } function checkimage() { iterations += 1; if (base.completeimg($currentimg.get(0))) { addheight(); } else if (iterations <= 100) { //if image loads in less than 10 seconds window.settimeout(checkimage, 100); } 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 : ["", ""], 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));