owlcarousel-rails 0.1.31 → 1.1.3.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8cabd4fe1522910e3c47b674b37a3699bd26faeb
4
- data.tar.gz: 922182b1523ab3583fb173a31ceecd4b95e31270
3
+ metadata.gz: 3e9f11b4c179fe672ee6962ca3f34c4deb0deca0
4
+ data.tar.gz: d01a1d23d730d44a113b91b218d0ffce263bab2a
5
5
  SHA512:
6
- metadata.gz: 7790e0520b987b2501b327101731b1dc9ac12e746a781d3e8b99b19d51a4a8e58c95a2b12b8cf1173e4de7c1a4b69210611a4a0d50796eb7af269c78e696b33b
7
- data.tar.gz: 840d6b94b062d3a5da404f737d60250323429a591ece6a77c2a314f55108194e008d1b942e58e36a02f426794c64ac614e500bc5b0a3df660026850f260fe959
6
+ metadata.gz: 00961ee9766a27f23f66d46f2defcc3e59079d4c7ddcb5ac4e6cc0c7eed0dba3c23e49dd58f33090e27c0b801f51a1ebe1a9fd19a2013445823e50e12fbff9e5
7
+ data.tar.gz: 0e0e9f9952d9f427a7eaabbd60cb08fec2d8f61c2ec7202cebd74771029dbc586e288127cc484f61aa4b2da14ede6511fff69a2c367f1722770421a4a57f271a
data/.gitignore ADDED
@@ -0,0 +1,7 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
5
+ .DS_Store
6
+ .bin
7
+ vendor/bundle
data/README.md CHANGED
@@ -14,7 +14,7 @@ Touch enabled jQuery plugin that lets you create beautiful responsive carousel s
14
14
  * Multiple Sliders
15
15
  * CSS3 3d Transitions
16
16
  * Custimizable controls
17
- * JSON
17
+ * JSON
18
18
  * Custom events
19
19
  * Helpful callbacks
20
20
 
@@ -32,16 +32,22 @@ See what Owl can do:
32
32
  ### 1.Getting Started
33
33
  Load jQuery(1.7+) and include Owl Carousel plugin files
34
34
 
35
- ```html
36
- <!-- Basic stylesheet -->
37
- <link rel="stylesheet" href="owl-carousel/owl.carousel.css">
38
-
39
- <!-- Default Theme -->
40
- <link rel="stylesheet" href="owl-carousel/owl.theme.css">
41
-
42
- <!-- Include js plugin -->
43
- <script src="owl-carousel/owl.carousel.js"></script>
35
+ add to your Gemfile
36
+ ```ruby
37
+ gem 'owlcarousel-rails'
38
+ ```
39
+
40
+ add to your application.js
41
+ ```ruby
42
+ //= require owl.carousel
44
43
  ```
44
+
45
+ add to your application.css
46
+ ```ruby
47
+ *= require owl.carousel
48
+ *= require owl.theme
49
+ ```
50
+
45
51
  ### 2.Set up your HTML
46
52
  You don't need any special markup. All you need is to wrap your divs inside the container element <div class="owl-carousel">. Class "owl-carousel" is mandatory to apply proper styles that come from owl.carousel.css file.
47
53
 
@@ -1,5 +1,5 @@
1
1
  module Owlcarousel
2
2
  module Rails
3
- VERSION = "0.1.31"
3
+ VERSION = "1.1.3.2"
4
4
  end
5
5
  end
@@ -1,1470 +1,1512 @@
1
1
  /*
2
- * jQuery OwlCarousel v1.31
2
+ * jQuery OwlCarousel v1.3.2
3
3
  *
4
- * Copyright (c) 2013 Bartosz Wojciechowski
5
- * http://www.owlgraphic.com/owlcarousel/
4
+ * Copyright (c) 2013 Bartosz Wojciechowski
5
+ * http://www.owlgraphic.com/owlcarousel/
6
6
  *
7
- * Licensed under MIT
7
+ * Licensed under MIT
8
8
  *
9
9
  */
10
10
 
11
- if ( typeof Object.create !== "function" ) {
12
- Object.create = function( obj ) {
13
- function F() {};
14
- F.prototype = obj;
15
- return new F();
16
- };
11
+ /*JS Lint helpers: */
12
+ /*global dragMove: false, dragEnd: false, $, jQuery, alert, window, document */
13
+ /*jslint nomen: true, continue:true */
14
+
15
+ if (typeof Object.create !== "function") {
16
+ Object.create = function (obj) {
17
+ function F() {}
18
+ F.prototype = obj;
19
+ return new F();
20
+ };
17
21
  }
18
- (function( $, window, document, undefined ) {
19
-
20
- var Carousel = {
21
- init :function(options, el){
22
- var base = this;
23
-
24
- base.$elem = $(el);
25
-
26
- // options passed via js override options passed via data attributes
27
- base.options = $.extend({}, $.fn.owlCarousel.options, base.$elem.data(), options);
28
-
29
- base.userOptions = options;
30
- base.loadContent();
31
- },
32
-
33
- loadContent : function(){
34
- var base = this;
35
-
36
- if (typeof base.options.beforeInit === "function") {
37
- base.options.beforeInit.apply(this,[base.$elem]);
38
- }
39
-
40
- if (typeof base.options.jsonPath === "string") {
41
- var url = base.options.jsonPath;
42
-
43
- function getData(data) {
44
- if (typeof base.options.jsonSuccess === "function") {
45
- base.options.jsonSuccess.apply(this,[data]);
46
- } else {
47
- var content = "";
48
- for(var i in data["owl"]){
49
- content += data["owl"][i]["item"];
50
- }
51
- base.$elem.html(content);
52
- }
53
- base.logIn();
54
- }
55
- $.getJSON(url,getData);
56
- } else {
57
- base.logIn();
58
- }
59
- },
60
-
61
- logIn : function(action){
62
- var base = this;
63
-
64
- base.$elem.data("owl-originalStyles", base.$elem.attr("style"))
65
- .data("owl-originalClasses", base.$elem.attr("class"));
66
-
67
- base.$elem.css({opacity: 0});
68
- base.orignalItems = base.options.items;
69
- base.checkBrowser();
70
- base.wrapperWidth = 0;
71
- base.checkVisible;
72
- base.setVars();
73
- },
74
-
75
- setVars : function(){
76
- var base = this;
77
- if(base.$elem.children().length === 0){return false}
78
- base.baseClass();
79
- base.eventTypes();
80
- base.$userItems = base.$elem.children();
81
- base.itemsAmount = base.$userItems.length;
82
- base.wrapItems();
83
- base.$owlItems = base.$elem.find(".owl-item");
84
- base.$owlWrapper = base.$elem.find(".owl-wrapper");
85
- base.playDirection = "next";
86
- base.prevItem = 0;
87
- base.prevArr = [0];
88
- base.currentItem = 0;
89
- base.customEvents();
90
- base.onStartup();
91
- },
92
-
93
- onStartup : function(){
94
- var base = this;
95
- base.updateItems();
96
- base.calculateAll();
97
- base.buildControls();
98
- base.updateControls();
99
- base.response();
100
- base.moveEvents();
101
- base.stopOnHover();
102
- base.owlStatus();
103
-
104
- if(base.options.transitionStyle !== false){
105
- base.transitionTypes(base.options.transitionStyle);
106
- }
107
- if(base.options.autoPlay === true){
108
- base.options.autoPlay = 5000;
109
- }
110
- base.play();
111
-
112
- base.$elem.find(".owl-wrapper").css("display","block")
113
-
114
- if(!base.$elem.is(":visible")){
115
- base.watchVisibility();
116
- } else {
117
- base.$elem.css("opacity",1);
118
- }
119
- base.onstartup = false;
120
- base.eachMoveUpdate();
121
- if (typeof base.options.afterInit === "function") {
122
- base.options.afterInit.apply(this,[base.$elem]);
123
- }
124
- },
125
-
126
- eachMoveUpdate : function(){
127
- var base = this;
128
-
129
- if(base.options.lazyLoad === true){
130
- base.lazyLoad();
131
- }
132
- if(base.options.autoHeight === true){
133
- base.autoHeight();
134
- }
135
- base.onVisibleItems();
136
-
137
- if (typeof base.options.afterAction === "function") {
138
- base.options.afterAction.apply(this,[base.$elem]);
139
- }
140
- },
141
-
142
- updateVars : function(){
143
- var base = this;
144
- if(typeof base.options.beforeUpdate === "function") {
145
- base.options.beforeUpdate.apply(this,[base.$elem]);
146
- }
147
- base.watchVisibility();
148
- base.updateItems();
149
- base.calculateAll();
150
- base.updatePosition();
151
- base.updateControls();
152
- base.eachMoveUpdate();
153
- if(typeof base.options.afterUpdate === "function") {
154
- base.options.afterUpdate.apply(this,[base.$elem]);
155
- }
156
- },
157
-
158
- reload : function(elements){
159
- var base = this;
160
- setTimeout(function(){
161
- base.updateVars();
162
- },0)
163
- },
164
-
165
- watchVisibility : function(){
166
- var base = this;
167
-
168
- if(base.$elem.is(":visible") === false){
169
- base.$elem.css({opacity: 0});
170
- clearInterval(base.autoPlayInterval);
171
- clearInterval(base.checkVisible);
172
- } else {
173
- return false;
174
- }
175
- base.checkVisible = setInterval(function(){
176
- if (base.$elem.is(":visible")) {
177
- base.reload();
178
- base.$elem.animate({opacity: 1},200);
179
- clearInterval(base.checkVisible);
180
- }
181
- }, 500);
182
- },
183
-
184
- wrapItems : function(){
185
- var base = this;
186
- base.$userItems.wrapAll("<div class=\"owl-wrapper\">").wrap("<div class=\"owl-item\"></div>");
187
- base.$elem.find(".owl-wrapper").wrap("<div class=\"owl-wrapper-outer\">");
188
- base.wrapperOuter = base.$elem.find(".owl-wrapper-outer");
189
- base.$elem.css("display","block");
190
- },
191
-
192
- baseClass : function(){
193
- var base = this;
194
- var hasBaseClass = base.$elem.hasClass(base.options.baseClass);
195
- var hasThemeClass = base.$elem.hasClass(base.options.theme);
196
-
197
- if(!hasBaseClass){
198
- base.$elem.addClass(base.options.baseClass);
199
- }
200
-
201
- if(!hasThemeClass){
202
- base.$elem.addClass(base.options.theme);
203
- }
204
- },
205
-
206
- updateItems : function(){
207
- var base = this;
208
-
209
- if(base.options.responsive === false){
210
- return false;
211
- }
212
- if(base.options.singleItem === true){
213
- base.options.items = base.orignalItems = 1;
214
- base.options.itemsCustom = false;
215
- base.options.itemsDesktop = false;
216
- base.options.itemsDesktopSmall = false;
217
- base.options.itemsTablet = false;
218
- base.options.itemsTabletSmall = false;
219
- base.options.itemsMobile = false;
220
- return false;
221
- }
222
-
223
- var width = $(base.options.responsiveBaseWidth).width();
224
-
225
- if(width > (base.options.itemsDesktop[0] || base.orignalItems) ){
226
- base.options.items = base.orignalItems;
227
- }
228
-
229
- if(typeof(base.options.itemsCustom) !== 'undefined' && base.options.itemsCustom !== false){
230
- //Reorder array by screen size
231
- base.options.itemsCustom.sort(function(a,b){return a[0]-b[0];});
232
- for(var i in base.options.itemsCustom){
233
- if(typeof(base.options.itemsCustom[i]) !== 'undefined' && base.options.itemsCustom[i][0] <= width){
234
- base.options.items = base.options.itemsCustom[i][1];
235
- }
236
- }
237
- } else {
238
-
239
- if(width <= base.options.itemsDesktop[0] && base.options.itemsDesktop !== false){
240
- base.options.items = base.options.itemsDesktop[1];
241
- }
242
-
243
- if(width <= base.options.itemsDesktopSmall[0] && base.options.itemsDesktopSmall !== false){
244
- base.options.items = base.options.itemsDesktopSmall[1];
245
- }
246
-
247
- if(width <= base.options.itemsTablet[0] && base.options.itemsTablet !== false){
248
- base.options.items = base.options.itemsTablet[1];
249
- }
250
-
251
- if(width <= base.options.itemsTabletSmall[0] && base.options.itemsTabletSmall !== false){
252
- base.options.items = base.options.itemsTabletSmall[1];
253
- }
254
-
255
- if(width <= base.options.itemsMobile[0] && base.options.itemsMobile !== false){
256
- base.options.items = base.options.itemsMobile[1];
257
- }
258
- }
259
-
260
- //if number of items is less than declared
261
- if(base.options.items > base.itemsAmount && base.options.itemsScaleUp === true){
262
- base.options.items = base.itemsAmount;
263
- }
264
- },
265
-
266
- response : function(){
267
- var base = this,
268
- smallDelay;
269
- if(base.options.responsive !== true){
270
- return false
271
- }
272
- var lastWindowWidth = $(window).width();
273
-
274
- base.resizer = function(){
275
- if($(window).width() !== lastWindowWidth){
276
- if(base.options.autoPlay !== false){
277
- clearInterval(base.autoPlayInterval);
278
- }
279
- clearTimeout(smallDelay);
280
- smallDelay = setTimeout(function(){
281
- lastWindowWidth = $(window).width();
282
- base.updateVars();
283
- },base.options.responsiveRefreshRate);
284
- }
285
- }
286
- $(window).resize(base.resizer)
287
- },
288
-
289
- updatePosition : function(){
290
- var base = this;
291
- base.jumpTo(base.currentItem);
292
- if(base.options.autoPlay !== false){
293
- base.checkAp();
294
- }
295
- },
296
-
297
- appendItemsSizes : function(){
298
- var base = this;
299
-
300
- var roundPages = 0;
301
- var lastItem = base.itemsAmount - base.options.items;
302
-
303
- base.$owlItems.each(function(index){
304
- var $this = $(this);
305
- $this
306
- .css({"width": base.itemWidth})
307
- .data("owl-item",Number(index));
308
-
309
- if(index % base.options.items === 0 || index === lastItem){
310
- if(!(index > lastItem)){
311
- roundPages +=1;
312
- }
313
- }
314
- $this.data("owl-roundPages",roundPages)
315
- });
316
- },
317
-
318
- appendWrapperSizes : function(){
319
- var base = this;
320
- var width = 0;
321
-
322
- var width = base.$owlItems.length * base.itemWidth;
323
-
324
- base.$owlWrapper.css({
325
- "width": width*2,
326
- "left": 0
327
- });
328
- base.appendItemsSizes();
329
- },
330
-
331
- calculateAll : function(){
332
- var base = this;
333
- base.calculateWidth();
334
- base.appendWrapperSizes();
335
- base.loops();
336
- base.max();
337
- },
338
-
339
- calculateWidth : function(){
340
- var base = this;
341
- base.itemWidth = Math.round(base.$elem.width()/base.options.items)
342
- },
343
-
344
- max : function(){
345
- var base = this;
346
- var maximum = ((base.itemsAmount * base.itemWidth) - base.options.items * base.itemWidth) * -1;
347
- if(base.options.items > base.itemsAmount){
348
- base.maximumItem = 0;
349
- maximum = 0
350
- base.maximumPixels = 0;
351
- } else {
352
- base.maximumItem = base.itemsAmount - base.options.items;
353
- base.maximumPixels = maximum;
354
- }
355
- return maximum;
356
- },
357
-
358
- min : function(){
359
- return 0;
360
- },
361
-
362
- loops : function(){
363
- var base = this;
364
-
365
- base.positionsInArray = [0];
366
- base.pagesInArray = [];
367
- var prev = 0;
368
- var elWidth = 0;
369
-
370
- for(var i = 0; i<base.itemsAmount; i++){
371
- elWidth += base.itemWidth;
372
- base.positionsInArray.push(-elWidth);
373
-
374
- if(base.options.scrollPerPage === true){
375
- var item = $(base.$owlItems[i]);
376
- var roundPageNum = item.data("owl-roundPages");
377
- if(roundPageNum !== prev){
378
- base.pagesInArray[prev] = base.positionsInArray[i];
379
- prev = roundPageNum;
380
- }
381
- }
382
- }
383
- },
384
-
385
- buildControls : function(){
386
- var base = this;
387
- if(base.options.navigation === true || base.options.pagination === true){
388
- base.owlControls = $("<div class=\"owl-controls\"/>").toggleClass("clickable", !base.browser.isTouch).appendTo(base.$elem);
389
- }
390
- if(base.options.pagination === true){
391
- base.buildPagination();
392
- }
393
- if(base.options.navigation === true){
394
- base.buildButtons();
395
- }
396
- },
397
-
398
- buildButtons : function(){
399
- var base = this;
400
- var buttonsWrapper = $("<div class=\"owl-buttons\"/>")
401
- base.owlControls.append(buttonsWrapper);
402
-
403
- base.buttonPrev = $("<div/>",{
404
- "class" : "owl-prev",
405
- "html" : base.options.navigationText[0] || ""
406
- });
407
-
408
- base.buttonNext = $("<div/>",{
409
- "class" : "owl-next",
410
- "html" : base.options.navigationText[1] || ""
411
- });
412
-
413
- buttonsWrapper
414
- .append(base.buttonPrev)
415
- .append(base.buttonNext);
416
-
417
- buttonsWrapper.on("touchstart.owlControls mousedown.owlControls", "div[class^=\"owl\"]", function(event){
418
- event.preventDefault();
419
- })
420
-
421
- buttonsWrapper.on("touchend.owlControls mouseup.owlControls", "div[class^=\"owl\"]", function(event){
422
- event.preventDefault();
423
- if($(this).hasClass("owl-next")){
424
- base.next();
425
- } else{
426
- base.prev();
427
- }
428
- })
429
- },
430
-
431
- buildPagination : function(){
432
- var base = this;
433
-
434
- base.paginationWrapper = $("<div class=\"owl-pagination\"/>");
435
- base.owlControls.append(base.paginationWrapper);
436
-
437
- base.paginationWrapper.on("touchend.owlControls mouseup.owlControls", ".owl-page", function(event){
438
- event.preventDefault();
439
- if(Number($(this).data("owl-page")) !== base.currentItem){
440
- base.goTo( Number($(this).data("owl-page")), true);
441
- }
442
- });
443
- },
444
-
445
- updatePagination : function(){
446
- var base = this;
447
- if(base.options.pagination === false){
448
- return false;
449
- }
450
-
451
- base.paginationWrapper.html("");
452
-
453
- var counter = 0;
454
- var lastPage = base.itemsAmount - base.itemsAmount % base.options.items;
455
-
456
- for(var i = 0; i<base.itemsAmount; i++){
457
- if(i % base.options.items === 0){
458
- counter +=1;
459
- if(lastPage === i){
460
- var lastItem = base.itemsAmount - base.options.items;
461
- }
462
- var paginationButton = $("<div/>",{
463
- "class" : "owl-page"
464
- });
465
- var paginationButtonInner = $("<span></span>",{
466
- "text": base.options.paginationNumbers === true ? counter : "",
467
- "class": base.options.paginationNumbers === true ? "owl-numbers" : ""
468
- });
469
- paginationButton.append(paginationButtonInner);
470
-
471
- paginationButton.data("owl-page",lastPage === i ? lastItem : i);
472
- paginationButton.data("owl-roundPages",counter);
473
-
474
- base.paginationWrapper.append(paginationButton);
475
- }
476
- }
477
- base.checkPagination();
478
- },
479
- checkPagination : function(){
480
- var base = this;
481
- if(base.options.pagination === false){
482
- return false;
483
- }
484
- base.paginationWrapper.find(".owl-page").each(function(i,v){
485
- if($(this).data("owl-roundPages") === $(base.$owlItems[base.currentItem]).data("owl-roundPages") ){
486
- base.paginationWrapper
487
- .find(".owl-page")
488
- .removeClass("active");
489
- $(this).addClass("active");
490
- }
491
- });
492
- },
493
-
494
- checkNavigation : function(){
495
- var base = this;
496
-
497
- if(base.options.navigation === false){
498
- return false;
499
- }
500
- if(base.options.rewindNav === false){
501
- if(base.currentItem === 0 && base.maximumItem === 0){
502
- base.buttonPrev.addClass("disabled");
503
- base.buttonNext.addClass("disabled");
504
- } else if(base.currentItem === 0 && base.maximumItem !== 0){
505
- base.buttonPrev.addClass("disabled");
506
- base.buttonNext.removeClass("disabled");
507
- } else if (base.currentItem === base.maximumItem){
508
- base.buttonPrev.removeClass("disabled");
509
- base.buttonNext.addClass("disabled");
510
- } else if(base.currentItem !== 0 && base.currentItem !== base.maximumItem){
511
- base.buttonPrev.removeClass("disabled");
512
- base.buttonNext.removeClass("disabled");
513
- }
514
- }
515
- },
516
-
517
- updateControls : function(){
518
- var base = this;
519
- base.updatePagination();
520
- base.checkNavigation();
521
- if(base.owlControls){
522
- if(base.options.items >= base.itemsAmount){
523
- base.owlControls.hide();
524
- } else {
525
- base.owlControls.show();
526
- }
527
- }
528
- },
529
-
530
- destroyControls : function(){
531
- var base = this;
532
- if(base.owlControls){
533
- base.owlControls.remove();
534
- }
535
- },
536
-
537
- next : function(speed){
538
- var base = this;
539
-
540
- if(base.isTransition){
541
- return false;
542
- }
543
-
544
- base.currentItem += base.options.scrollPerPage === true ? base.options.items : 1;
545
- if(base.currentItem > base.maximumItem + (base.options.scrollPerPage == true ? (base.options.items - 1) : 0)){
546
- if(base.options.rewindNav === true){
547
- base.currentItem = 0;
548
- speed = "rewind";
549
- } else {
550
- base.currentItem = base.maximumItem;
551
- return false;
552
- }
553
- }
554
- base.goTo(base.currentItem,speed);
555
- },
556
-
557
- prev : function(speed){
558
- var base = this;
559
-
560
- if(base.isTransition){
561
- return false;
562
- }
563
-
564
- if(base.options.scrollPerPage === true && base.currentItem > 0 && base.currentItem < base.options.items){
565
- base.currentItem = 0
566
- } else {
567
- base.currentItem -= base.options.scrollPerPage === true ? base.options.items : 1;
568
- }
569
- if(base.currentItem < 0){
570
- if(base.options.rewindNav === true){
571
- base.currentItem = base.maximumItem;
572
- speed = "rewind"
573
- } else {
574
- base.currentItem =0;
575
- return false;
576
- }
577
- }
578
- base.goTo(base.currentItem,speed);
579
- },
580
-
581
- goTo : function(position,speed,drag){
582
- var base = this;
583
-
584
- if(base.isTransition){
585
- return false;
586
- }
587
- if(typeof base.options.beforeMove === "function") {
588
- base.options.beforeMove.apply(this,[base.$elem]);
589
- }
590
- if(position >= base.maximumItem){
591
- position = base.maximumItem;
592
- }
593
- else if( position <= 0 ){
594
- position = 0;
595
- }
596
-
597
- base.currentItem = base.owl.currentItem = position;
598
- if( base.options.transitionStyle !== false && drag !== "drag" && base.options.items === 1 && base.browser.support3d === true){
599
- base.swapSpeed(0)
600
- if(base.browser.support3d === true){
601
- base.transition3d(base.positionsInArray[position]);
602
- } else {
603
- base.css2slide(base.positionsInArray[position],1);
604
- }
605
- base.afterGo();
606
- base.singleItemTransition();
607
-
608
- return false;
609
- }
610
- var goToPixel = base.positionsInArray[position];
611
-
612
- if(base.browser.support3d === true){
613
- base.isCss3Finish = false;
614
-
615
- if(speed === true){
616
- base.swapSpeed("paginationSpeed");
617
- setTimeout(function() {
618
- base.isCss3Finish = true;
619
- }, base.options.paginationSpeed);
620
-
621
- } else if(speed === "rewind" ){
622
- base.swapSpeed(base.options.rewindSpeed);
623
- setTimeout(function() {
624
- base.isCss3Finish = true;
625
- }, base.options.rewindSpeed);
626
-
627
- } else {
628
- base.swapSpeed("slideSpeed");
629
- setTimeout(function() {
630
- base.isCss3Finish = true;
631
- }, base.options.slideSpeed);
632
- }
633
- base.transition3d(goToPixel);
634
- } else {
635
- if(speed === true){
636
- base.css2slide(goToPixel, base.options.paginationSpeed);
637
- } else if(speed === "rewind" ){
638
- base.css2slide(goToPixel, base.options.rewindSpeed);
639
- } else {
640
- base.css2slide(goToPixel, base.options.slideSpeed);
641
- }
642
- }
643
- base.afterGo();
644
- },
645
-
646
- jumpTo : function(position){
647
- var base = this;
648
- if(typeof base.options.beforeMove === "function") {
649
- base.options.beforeMove.apply(this,[base.$elem]);
650
- }
651
- if(position >= base.maximumItem || position === -1){
652
- position = base.maximumItem;
653
- }
654
- else if( position <= 0 ){
655
- position = 0;
656
- }
657
- base.swapSpeed(0)
658
- if(base.browser.support3d === true){
659
- base.transition3d(base.positionsInArray[position]);
660
- } else {
661
- base.css2slide(base.positionsInArray[position],1);
662
- }
663
- base.currentItem = base.owl.currentItem = position;
664
- base.afterGo();
665
- },
666
-
667
- afterGo : function(){
668
- var base = this;
669
-
670
- base.prevArr.push(base.currentItem);
671
- base.prevItem = base.owl.prevItem = base.prevArr[base.prevArr.length -2];
672
- base.prevArr.shift(0)
673
-
674
- if(base.prevItem !== base.currentItem){
675
- base.checkPagination();
676
- base.checkNavigation();
677
- base.eachMoveUpdate();
678
-
679
- if(base.options.autoPlay !== false){
680
- base.checkAp();
681
- }
682
- }
683
- if(typeof base.options.afterMove === "function" && base.prevItem !== base.currentItem) {
684
- base.options.afterMove.apply(this,[base.$elem]);
685
- }
686
- },
687
-
688
- stop : function(){
689
- var base = this;
690
- base.apStatus = "stop";
691
- clearInterval(base.autoPlayInterval);
692
- },
693
-
694
- checkAp : function(){
695
- var base = this;
696
- if(base.apStatus !== "stop"){
697
- base.play();
698
- }
699
- },
700
-
701
- play : function(){
702
- var base = this;
703
- base.apStatus = "play";
704
- if(base.options.autoPlay === false){
705
- return false;
706
- }
707
- clearInterval(base.autoPlayInterval);
708
- base.autoPlayInterval = setInterval(function(){
709
- base.next(true);
710
- },base.options.autoPlay);
711
- },
712
-
713
- swapSpeed : function(action){
714
- var base = this;
715
- if(action === "slideSpeed"){
716
- base.$owlWrapper.css(base.addCssSpeed(base.options.slideSpeed));
717
- } else if(action === "paginationSpeed" ){
718
- base.$owlWrapper.css(base.addCssSpeed(base.options.paginationSpeed));
719
- } else if(typeof action !== "string"){
720
- base.$owlWrapper.css(base.addCssSpeed(action));
721
- }
722
- },
723
-
724
- addCssSpeed : function(speed){
725
- var base = this;
726
- return {
727
- "-webkit-transition": "all "+ speed +"ms ease",
728
- "-moz-transition": "all "+ speed +"ms ease",
729
- "-o-transition": "all "+ speed +"ms ease",
730
- "transition": "all "+ speed +"ms ease"
731
- };
732
- },
733
-
734
- removeTransition : function(){
735
- return {
736
- "-webkit-transition": "",
737
- "-moz-transition": "",
738
- "-o-transition": "",
739
- "transition": ""
740
- };
741
- },
742
-
743
- doTranslate : function(pixels){
744
- return {
745
- "-webkit-transform": "translate3d("+pixels+"px, 0px, 0px)",
746
- "-moz-transform": "translate3d("+pixels+"px, 0px, 0px)",
747
- "-o-transform": "translate3d("+pixels+"px, 0px, 0px)",
748
- "-ms-transform": "translate3d("+pixels+"px, 0px, 0px)",
749
- "transform": "translate3d("+pixels+"px, 0px,0px)"
750
- };
751
- },
752
-
753
- transition3d : function(value){
754
- var base = this;
755
- base.$owlWrapper.css(base.doTranslate(value));
756
- },
757
-
758
- css2move : function(value){
759
- var base = this;
760
- base.$owlWrapper.css({"left" : value})
761
- },
762
-
763
- css2slide : function(value,speed){
764
- var base = this;
765
-
766
- base.isCssFinish = false;
767
- base.$owlWrapper.stop(true,true).animate({
768
- "left" : value
769
- }, {
770
- duration : speed || base.options.slideSpeed ,
771
- complete : function(){
772
- base.isCssFinish = true;
773
- }
774
- });
775
- },
776
-
777
- checkBrowser : function(){
778
- var base = this;
779
-
780
- //Check 3d support
781
- var translate3D = "translate3d(0px, 0px, 0px)",
782
- tempElem = document.createElement("div");
783
-
784
- tempElem.style.cssText= " -moz-transform:" + translate3D +
785
- "; -ms-transform:" + translate3D +
786
- "; -o-transform:" + translate3D +
787
- "; -webkit-transform:" + translate3D +
788
- "; transform:" + translate3D;
789
- var regex = /translate3d\(0px, 0px, 0px\)/g,
790
- asSupport = tempElem.style.cssText.match(regex),
791
- support3d = (asSupport !== null && asSupport.length === 1);
792
-
793
- var isTouch = "ontouchstart" in window || navigator.msMaxTouchPoints;
794
-
795
- base.browser = {
796
- "support3d" : support3d,
797
- "isTouch" : isTouch
798
- }
799
- },
800
-
801
- moveEvents : function(){
802
- var base = this;
803
- if(base.options.mouseDrag !== false || base.options.touchDrag !== false){
804
- base.gestures();
805
- base.disabledEvents();
806
- }
807
- },
808
-
809
- eventTypes : function(){
810
- var base = this;
811
- var types = ["s","e","x"];
812
-
813
- base.ev_types = {};
814
-
815
- if(base.options.mouseDrag === true && base.options.touchDrag === true){
816
- types = [
817
- "touchstart.owl mousedown.owl",
818
- "touchmove.owl mousemove.owl",
819
- "touchend.owl touchcancel.owl mouseup.owl"
820
- ];
821
- } else if(base.options.mouseDrag === false && base.options.touchDrag === true){
822
- types = [
823
- "touchstart.owl",
824
- "touchmove.owl",
825
- "touchend.owl touchcancel.owl"
826
- ];
827
- } else if(base.options.mouseDrag === true && base.options.touchDrag === false){
828
- types = [
829
- "mousedown.owl",
830
- "mousemove.owl",
831
- "mouseup.owl"
832
- ];
833
- }
834
-
835
- base.ev_types["start"] = types[0];
836
- base.ev_types["move"] = types[1];
837
- base.ev_types["end"] = types[2];
838
- },
839
-
840
- disabledEvents : function(){
841
- var base = this;
842
- base.$elem.on("dragstart.owl", function(event) { event.preventDefault();});
843
- base.$elem.on("mousedown.disableTextSelect", function(e) {
844
- return $(e.target).is('input, textarea, select, option');
845
- });
846
- },
847
-
848
- gestures : function(){
849
- var base = this;
850
-
851
- var locals = {
852
- offsetX : 0,
853
- offsetY : 0,
854
- baseElWidth : 0,
855
- relativePos : 0,
856
- position: null,
857
- minSwipe : null,
858
- maxSwipe: null,
859
- sliding : null,
860
- dargging: null,
861
- targetElement : null
862
- }
863
-
864
- base.isCssFinish = true;
865
-
866
- function getTouches(event){
867
- if(event.touches){
868
- return {
869
- x : event.touches[0].pageX,
870
- y : event.touches[0].pageY
871
- }
872
- } else {
873
- if(event.pageX !== undefined){
874
- return {
875
- x : event.pageX,
876
- y : event.pageY
877
- }
878
- } else {
879
- return {
880
- x : event.clientX,
881
- y : event.clientY
882
- }
883
- }
884
- }
885
- }
886
-
887
- function swapEvents(type){
888
- if(type === "on"){
889
- $(document).on(base.ev_types["move"], dragMove);
890
- $(document).on(base.ev_types["end"], dragEnd);
891
- } else if(type === "off"){
892
- $(document).off(base.ev_types["move"]);
893
- $(document).off(base.ev_types["end"]);
894
- }
895
- }
896
-
897
- function dragStart(event) {
898
- var event = event.originalEvent || event || window.event;
899
-
900
- if (event.which === 3) {
901
- return false;
902
- }
903
- if(base.itemsAmount <= base.options.items){
904
- return;
905
- }
906
- if(base.isCssFinish === false && !base.options.dragBeforeAnimFinish ){
907
- return false;
908
- }
909
- if(base.isCss3Finish === false && !base.options.dragBeforeAnimFinish ){
910
- return false;
911
- }
912
-
913
- if(base.options.autoPlay !== false){
914
- clearInterval(base.autoPlayInterval);
915
- }
916
-
917
- if(base.browser.isTouch !== true && !base.$owlWrapper.hasClass("grabbing")){
918
- base.$owlWrapper.addClass("grabbing")
919
- }
920
-
921
- base.newPosX = 0;
922
- base.newRelativeX = 0;
923
-
924
- $(this).css(base.removeTransition());
925
-
926
- var position = $(this).position();
927
- locals.relativePos = position.left;
928
-
929
- locals.offsetX = getTouches(event).x - position.left;
930
- locals.offsetY = getTouches(event).y - position.top;
931
-
932
- swapEvents("on");
933
-
934
- locals.sliding = false;
935
- locals.targetElement = event.target || event.srcElement;
936
- }
937
-
938
- function dragMove(event){
939
- var event = event.originalEvent || event || window.event;
940
-
941
- base.newPosX = getTouches(event).x- locals.offsetX;
942
- base.newPosY = getTouches(event).y - locals.offsetY;
943
- base.newRelativeX = base.newPosX - locals.relativePos;
944
-
945
- if (typeof base.options.startDragging === "function" && locals.dragging !== true && base.newRelativeX !== 0) {
946
- locals.dragging = true;
947
- base.options.startDragging.apply(base,[base.$elem]);
948
- }
949
-
950
- if(base.newRelativeX > 8 || base.newRelativeX < -8 && base.browser.isTouch === true){
951
- event.preventDefault ? event.preventDefault() : event.returnValue = false;
952
- locals.sliding = true;
953
- }
954
-
955
- if((base.newPosY > 10 || base.newPosY < -10) && locals.sliding === false){
956
- $(document).off("touchmove.owl");
957
- }
958
-
959
- var minSwipe = function(){
960
- return base.newRelativeX / 5;
961
- }
962
- var maxSwipe = function(){
963
- return base.maximumPixels + base.newRelativeX / 5;
964
- }
965
-
966
- base.newPosX = Math.max(Math.min( base.newPosX, minSwipe() ), maxSwipe() );
967
- if(base.browser.support3d === true){
968
- base.transition3d(base.newPosX);
969
- } else {
970
- base.css2move(base.newPosX);
971
- }
972
- }
973
-
974
- function dragEnd(event){
975
- var event = event.originalEvent || event || window.event;
976
- event.target = event.target || event.srcElement;
977
-
978
- locals.dragging = false;
979
-
980
- if(base.browser.isTouch !== true){
981
- base.$owlWrapper.removeClass("grabbing");
982
- }
983
-
984
- if(base.newRelativeX<0){
985
- base.dragDirection = base.owl.dragDirection = "left"
986
- } else {
987
- base.dragDirection = base.owl.dragDirection = "right"
988
- }
989
-
990
- if(base.newRelativeX !== 0){
991
- var newPosition = base.getNewPosition();
992
- base.goTo(newPosition,false,"drag");
993
- if(locals.targetElement === event.target && base.browser.isTouch !== true){
994
- $(event.target).on("click.disable", function(ev){
995
- ev.stopImmediatePropagation();
996
- ev.stopPropagation();
997
- ev.preventDefault();
998
- $(event.target).off("click.disable");
999
- });
1000
- var handlers = $._data(event.target, "events")["click"];
1001
- var owlStopEvent = handlers.pop();
1002
- handlers.splice(0, 0, owlStopEvent);
1003
- }
1004
- }
1005
- swapEvents("off");
1006
- }
1007
- base.$elem.on(base.ev_types["start"], ".owl-wrapper", dragStart);
1008
- },
1009
-
1010
- getNewPosition : function(){
1011
- var base = this,
1012
- newPosition;
1013
-
1014
- newPosition = base.closestItem();
1015
-
1016
- if(newPosition>base.maximumItem){
1017
- base.currentItem = base.maximumItem;
1018
- newPosition = base.maximumItem;
1019
- } else if( base.newPosX >=0 ){
1020
- newPosition = 0;
1021
- base.currentItem = 0;
1022
- }
1023
- return newPosition;
1024
- },
1025
- closestItem : function(){
1026
- var base = this,
1027
- array = base.options.scrollPerPage === true ? base.pagesInArray : base.positionsInArray,
1028
- goal = base.newPosX,
1029
- closest = null;
1030
-
1031
- $.each(array, function(i,v){
1032
- if( goal - (base.itemWidth/20) > array[i+1] && goal - (base.itemWidth/20)< v && base.moveDirection() === "left") {
1033
- closest = v;
1034
- if(base.options.scrollPerPage === true){
1035
- base.currentItem = $.inArray(closest, base.positionsInArray);
1036
- } else {
1037
- base.currentItem = i;
1038
- }
1039
- }
1040
- else if (goal + (base.itemWidth/20) < v && goal + (base.itemWidth/20) > (array[i+1] || array[i]-base.itemWidth) && base.moveDirection() === "right"){
1041
- if(base.options.scrollPerPage === true){
1042
- closest = array[i+1] || array[array.length-1];
1043
- base.currentItem = $.inArray(closest, base.positionsInArray);
1044
- } else {
1045
- closest = array[i+1];
1046
- base.currentItem = i+1;
1047
- }
1048
- }
1049
- });
1050
- return base.currentItem;
1051
- },
1052
-
1053
- moveDirection : function(){
1054
- var base = this,
1055
- direction;
1056
- if(base.newRelativeX < 0 ){
1057
- direction = "right"
1058
- base.playDirection = "next"
1059
- } else {
1060
- direction = "left"
1061
- base.playDirection = "prev"
1062
- }
1063
- return direction
1064
- },
1065
-
1066
- customEvents : function(){
1067
- var base = this;
1068
- base.$elem.on("owl.next",function(){
1069
- base.next();
1070
- });
1071
- base.$elem.on("owl.prev",function(){
1072
- base.prev();
1073
- });
1074
- base.$elem.on("owl.play",function(event,speed){
1075
- base.options.autoPlay = speed;
1076
- base.play();
1077
- base.hoverStatus = "play";
1078
- });
1079
- base.$elem.on("owl.stop",function(){
1080
- base.stop();
1081
- base.hoverStatus = "stop";
1082
- });
1083
- base.$elem.on("owl.goTo",function(event,item){
1084
- base.goTo(item)
1085
- });
1086
- base.$elem.on("owl.jumpTo",function(event,item){
1087
- base.jumpTo(item)
1088
- });
1089
- },
1090
-
1091
- stopOnHover : function(){
1092
- var base = this;
1093
- if(base.options.stopOnHover === true && base.browser.isTouch !== true && base.options.autoPlay !== false){
1094
- base.$elem.on("mouseover", function(){
1095
- base.stop();
1096
- });
1097
- base.$elem.on("mouseout", function(){
1098
- if(base.hoverStatus !== "stop"){
1099
- base.play();
1100
- }
1101
- });
1102
- }
1103
- },
1104
-
1105
- lazyLoad : function(){
1106
- var base = this;
1107
-
1108
- if(base.options.lazyLoad === false){
1109
- return false;
1110
- }
1111
- for(var i=0; i<base.itemsAmount; i++){
1112
- var $item = $(base.$owlItems[i]);
1113
-
1114
- if($item.data("owl-loaded") === "loaded"){
1115
- continue;
1116
- }
1117
-
1118
- var itemNumber = $item.data("owl-item"),
1119
- $lazyImg = $item.find(".lazyOwl"),
1120
- follow;
1121
-
1122
- if( typeof $lazyImg.data("src") !== "string"){
1123
- $item.data("owl-loaded","loaded");
1124
- continue;
1125
- }
1126
- if($item.data("owl-loaded") === undefined){
1127
- $lazyImg.hide();
1128
- $item.addClass("loading").data("owl-loaded","checked");
1129
- }
1130
- if(base.options.lazyFollow === true){
1131
- follow = itemNumber >= base.currentItem;
1132
- } else {
1133
- follow = true;
1134
- }
1135
- if(follow && itemNumber < base.currentItem + base.options.items && $lazyImg.length){
1136
- base.lazyPreload($item,$lazyImg);
1137
- }
1138
- }
1139
- },
1140
-
1141
- lazyPreload : function($item,$lazyImg){
1142
- var base = this,
1143
- iterations = 0;
1144
- if ($lazyImg.prop("tagName") === "DIV") {
1145
- $lazyImg.css("background-image", "url(" + $lazyImg.data("src")+ ")" );
1146
- var isBackgroundImg=true;
1147
- } else {
1148
- $lazyImg[0].src = $lazyImg.data("src");
1149
- }
1150
- checkLazyImage();
1151
-
1152
- function checkLazyImage(){
1153
- iterations += 1;
1154
- if (base.completeImg($lazyImg.get(0)) || isBackgroundImg === true) {
1155
- showImage();
1156
- } else if(iterations <= 100){//if image loads in less than 10 seconds
1157
- setTimeout(checkLazyImage,100);
1158
- } else {
1159
- showImage();
1160
- }
1161
- }
1162
- function showImage(){
1163
- $item.data("owl-loaded", "loaded").removeClass("loading");
1164
- $lazyImg.removeAttr("data-src");
1165
- base.options.lazyEffect === "fade" ? $lazyImg.fadeIn(400) : $lazyImg.show();
1166
- if(typeof base.options.afterLazyLoad === "function") {
1167
- base.options.afterLazyLoad.apply(this,[base.$elem]);
1168
- }
1169
- }
1170
- },
1171
-
1172
- autoHeight : function(){
1173
- var base = this;
1174
- var $currentimg = $(base.$owlItems[base.currentItem]).find("img");
1175
-
1176
- if($currentimg.get(0) !== undefined ){
1177
- var iterations = 0;
1178
- checkImage();
1179
- } else {
1180
- addHeight();
1181
- }
1182
- function checkImage(){
1183
- iterations += 1;
1184
- if ( base.completeImg($currentimg.get(0)) ) {
1185
- addHeight();
1186
- } else if(iterations <= 100){ //if image loads in less than 10 seconds
1187
- setTimeout(checkImage,100);
1188
- } else {
1189
- base.wrapperOuter.css("height", ""); //Else remove height attribute
1190
- }
1191
- }
1192
-
1193
- function addHeight(){
1194
- var $currentItem = $(base.$owlItems[base.currentItem]).height();
1195
- base.wrapperOuter.css("height",$currentItem+"px");
1196
- if(!base.wrapperOuter.hasClass("autoHeight")){
1197
- setTimeout(function(){
1198
- base.wrapperOuter.addClass("autoHeight");
1199
- },0);
1200
- }
1201
- }
1202
- },
1203
-
1204
- completeImg : function(img) {
1205
- if (!img.complete) {
1206
- return false;
1207
- }
1208
- if (typeof img.naturalWidth !== "undefined" && img.naturalWidth == 0) {
1209
- return false;
1210
- }
1211
- return true;
1212
- },
1213
-
1214
- onVisibleItems : function(){
1215
- var base = this;
1216
-
1217
- if(base.options.addClassActive === true){
1218
- base.$owlItems.removeClass("active");
1219
- }
1220
- base.visibleItems = [];
1221
- for(var i=base.currentItem; i<base.currentItem + base.options.items; i++){
1222
- base.visibleItems.push(i);
1223
-
1224
- if(base.options.addClassActive === true){
1225
- $(base.$owlItems[i]).addClass("active");
1226
- }
1227
- }
1228
- base.owl.visibleItems = base.visibleItems;
1229
- },
1230
-
1231
- transitionTypes : function(className){
1232
- var base = this;
1233
- //Currently available: "fade","backSlide","goDown","fadeUp"
1234
- base.outClass = "owl-"+className+"-out";
1235
- base.inClass = "owl-"+className+"-in";
1236
- },
1237
-
1238
- singleItemTransition : function(){
1239
- var base = this;
1240
- base.isTransition = true;
1241
-
1242
- var outClass = base.outClass,
1243
- inClass = base.inClass,
1244
- $currentItem = base.$owlItems.eq(base.currentItem),
1245
- $prevItem = base.$owlItems.eq(base.prevItem),
1246
- prevPos = Math.abs(base.positionsInArray[base.currentItem]) + base.positionsInArray[base.prevItem],
1247
- origin = Math.abs(base.positionsInArray[base.currentItem])+base.itemWidth/2;
22
+ (function ($, window, document) {
23
+
24
+ var Carousel = {
25
+ init : function (options, el) {
26
+ var base = this;
27
+
28
+ base.$elem = $(el);
29
+ base.options = $.extend({}, $.fn.owlCarousel.options, base.$elem.data(), options);
30
+
31
+ base.userOptions = options;
32
+ base.loadContent();
33
+ },
34
+
35
+ loadContent : function () {
36
+ var base = this, url;
37
+
38
+ function getData(data) {
39
+ var i, content = "";
40
+ if (typeof base.options.jsonSuccess === "function") {
41
+ base.options.jsonSuccess.apply(this, [data]);
42
+ } else {
43
+ for (i in data.owl) {
44
+ if (data.owl.hasOwnProperty(i)) {
45
+ content += data.owl[i].item;
46
+ }
47
+ }
48
+ base.$elem.html(content);
49
+ }
50
+ base.logIn();
51
+ }
52
+
53
+ if (typeof base.options.beforeInit === "function") {
54
+ base.options.beforeInit.apply(this, [base.$elem]);
55
+ }
56
+
57
+ if (typeof base.options.jsonPath === "string") {
58
+ url = base.options.jsonPath;
59
+ $.getJSON(url, getData);
60
+ } else {
61
+ base.logIn();
62
+ }
63
+ },
64
+
65
+ logIn : function () {
66
+ var base = this;
67
+
68
+ base.$elem.data("owl-originalStyles", base.$elem.attr("style"))
69
+ .data("owl-originalClasses", base.$elem.attr("class"));
70
+
71
+ base.$elem.css({opacity: 0});
72
+ base.orignalItems = base.options.items;
73
+ base.checkBrowser();
74
+ base.wrapperWidth = 0;
75
+ base.checkVisible = null;
76
+ base.setVars();
77
+ },
78
+
79
+ setVars : function () {
80
+ var base = this;
81
+ if (base.$elem.children().length === 0) {return false; }
82
+ base.baseClass();
83
+ base.eventTypes();
84
+ base.$userItems = base.$elem.children();
85
+ base.itemsAmount = base.$userItems.length;
86
+ base.wrapItems();
87
+ base.$owlItems = base.$elem.find(".owl-item");
88
+ base.$owlWrapper = base.$elem.find(".owl-wrapper");
89
+ base.playDirection = "next";
90
+ base.prevItem = 0;
91
+ base.prevArr = [0];
92
+ base.currentItem = 0;
93
+ base.customEvents();
94
+ base.onStartup();
95
+ },
96
+
97
+ onStartup : function () {
98
+ var base = this;
99
+ base.updateItems();
100
+ base.calculateAll();
101
+ base.buildControls();
102
+ base.updateControls();
103
+ base.response();
104
+ base.moveEvents();
105
+ base.stopOnHover();
106
+ base.owlStatus();
107
+
108
+ if (base.options.transitionStyle !== false) {
109
+ base.transitionTypes(base.options.transitionStyle);
110
+ }
111
+ if (base.options.autoPlay === true) {
112
+ base.options.autoPlay = 5000;
113
+ }
114
+ base.play();
115
+
116
+ base.$elem.find(".owl-wrapper").css("display", "block");
117
+
118
+ if (!base.$elem.is(":visible")) {
119
+ base.watchVisibility();
120
+ } else {
121
+ base.$elem.css("opacity", 1);
122
+ }
123
+ base.onstartup = false;
124
+ base.eachMoveUpdate();
125
+ if (typeof base.options.afterInit === "function") {
126
+ base.options.afterInit.apply(this, [base.$elem]);
127
+ }
128
+ },
129
+
130
+ eachMoveUpdate : function () {
131
+ var base = this;
132
+
133
+ if (base.options.lazyLoad === true) {
134
+ base.lazyLoad();
135
+ }
136
+ if (base.options.autoHeight === true) {
137
+ base.autoHeight();
138
+ }
139
+ base.onVisibleItems();
140
+
141
+ if (typeof base.options.afterAction === "function") {
142
+ base.options.afterAction.apply(this, [base.$elem]);
143
+ }
144
+ },
145
+
146
+ updateVars : function () {
147
+ var base = this;
148
+ if (typeof base.options.beforeUpdate === "function") {
149
+ base.options.beforeUpdate.apply(this, [base.$elem]);
150
+ }
151
+ base.watchVisibility();
152
+ base.updateItems();
153
+ base.calculateAll();
154
+ base.updatePosition();
155
+ base.updateControls();
156
+ base.eachMoveUpdate();
157
+ if (typeof base.options.afterUpdate === "function") {
158
+ base.options.afterUpdate.apply(this, [base.$elem]);
159
+ }
160
+ },
161
+
162
+ reload : function () {
163
+ var base = this;
164
+ window.setTimeout(function () {
165
+ base.updateVars();
166
+ }, 0);
167
+ },
168
+
169
+ watchVisibility : function () {
170
+ var base = this;
171
+
172
+ if (base.$elem.is(":visible") === false) {
173
+ base.$elem.css({opacity: 0});
174
+ window.clearInterval(base.autoPlayInterval);
175
+ window.clearInterval(base.checkVisible);
176
+ } else {
177
+ return false;
178
+ }
179
+ base.checkVisible = window.setInterval(function () {
180
+ if (base.$elem.is(":visible")) {
181
+ base.reload();
182
+ base.$elem.animate({opacity: 1}, 200);
183
+ window.clearInterval(base.checkVisible);
184
+ }
185
+ }, 500);
186
+ },
187
+
188
+ wrapItems : function () {
189
+ var base = this;
190
+ base.$userItems.wrapAll("<div class=\"owl-wrapper\">").wrap("<div class=\"owl-item\"></div>");
191
+ base.$elem.find(".owl-wrapper").wrap("<div class=\"owl-wrapper-outer\">");
192
+ base.wrapperOuter = base.$elem.find(".owl-wrapper-outer");
193
+ base.$elem.css("display", "block");
194
+ },
195
+
196
+ baseClass : function () {
197
+ var base = this,
198
+ hasBaseClass = base.$elem.hasClass(base.options.baseClass),
199
+ hasThemeClass = base.$elem.hasClass(base.options.theme);
200
+
201
+ if (!hasBaseClass) {
202
+ base.$elem.addClass(base.options.baseClass);
203
+ }
204
+
205
+ if (!hasThemeClass) {
206
+ base.$elem.addClass(base.options.theme);
207
+ }
208
+ },
209
+
210
+ updateItems : function () {
211
+ var base = this, width, i;
212
+
213
+ if (base.options.responsive === false) {
214
+ return false;
215
+ }
216
+ if (base.options.singleItem === true) {
217
+ base.options.items = base.orignalItems = 1;
218
+ base.options.itemsCustom = false;
219
+ base.options.itemsDesktop = false;
220
+ base.options.itemsDesktopSmall = false;
221
+ base.options.itemsTablet = false;
222
+ base.options.itemsTabletSmall = false;
223
+ base.options.itemsMobile = false;
224
+ return false;
225
+ }
226
+
227
+ width = $(base.options.responsiveBaseWidth).width();
228
+
229
+ if (width > (base.options.itemsDesktop[0] || base.orignalItems)) {
230
+ base.options.items = base.orignalItems;
231
+ }
232
+ if (base.options.itemsCustom !== false) {
233
+ //Reorder array by screen size
234
+ base.options.itemsCustom.sort(function (a, b) {return a[0] - b[0]; });
235
+
236
+ for (i = 0; i < base.options.itemsCustom.length; i += 1) {
237
+ if (base.options.itemsCustom[i][0] <= width) {
238
+ base.options.items = base.options.itemsCustom[i][1];
239
+ }
240
+ }
241
+
242
+ } else {
243
+
244
+ if (width <= base.options.itemsDesktop[0] && base.options.itemsDesktop !== false) {
245
+ base.options.items = base.options.itemsDesktop[1];
246
+ }
247
+
248
+ if (width <= base.options.itemsDesktopSmall[0] && base.options.itemsDesktopSmall !== false) {
249
+ base.options.items = base.options.itemsDesktopSmall[1];
250
+ }
251
+
252
+ if (width <= base.options.itemsTablet[0] && base.options.itemsTablet !== false) {
253
+ base.options.items = base.options.itemsTablet[1];
254
+ }
255
+
256
+ if (width <= base.options.itemsTabletSmall[0] && base.options.itemsTabletSmall !== false) {
257
+ base.options.items = base.options.itemsTabletSmall[1];
258
+ }
259
+
260
+ if (width <= base.options.itemsMobile[0] && base.options.itemsMobile !== false) {
261
+ base.options.items = base.options.itemsMobile[1];
262
+ }
263
+ }
264
+
265
+ //if number of items is less than declared
266
+ if (base.options.items > base.itemsAmount && base.options.itemsScaleUp === true) {
267
+ base.options.items = base.itemsAmount;
268
+ }
269
+ },
270
+
271
+ response : function () {
272
+ var base = this,
273
+ smallDelay,
274
+ lastWindowWidth;
275
+
276
+ if (base.options.responsive !== true) {
277
+ return false;
278
+ }
279
+ lastWindowWidth = $(window).width();
280
+
281
+ base.resizer = function () {
282
+ if ($(window).width() !== lastWindowWidth) {
283
+ if (base.options.autoPlay !== false) {
284
+ window.clearInterval(base.autoPlayInterval);
285
+ }
286
+ window.clearTimeout(smallDelay);
287
+ smallDelay = window.setTimeout(function () {
288
+ lastWindowWidth = $(window).width();
289
+ base.updateVars();
290
+ }, base.options.responsiveRefreshRate);
291
+ }
292
+ };
293
+ $(window).resize(base.resizer);
294
+ },
295
+
296
+ updatePosition : function () {
297
+ var base = this;
298
+ base.jumpTo(base.currentItem);
299
+ if (base.options.autoPlay !== false) {
300
+ base.checkAp();
301
+ }
302
+ },
303
+
304
+ appendItemsSizes : function () {
305
+ var base = this,
306
+ roundPages = 0,
307
+ lastItem = base.itemsAmount - base.options.items;
308
+
309
+ base.$owlItems.each(function (index) {
310
+ var $this = $(this);
311
+ $this
312
+ .css({"width": base.itemWidth})
313
+ .data("owl-item", Number(index));
314
+
315
+ if (index % base.options.items === 0 || index === lastItem) {
316
+ if (!(index > lastItem)) {
317
+ roundPages += 1;
318
+ }
319
+ }
320
+ $this.data("owl-roundPages", roundPages);
321
+ });
322
+ },
323
+
324
+ appendWrapperSizes : function () {
325
+ var base = this,
326
+ width = base.$owlItems.length * base.itemWidth;
327
+
328
+ base.$owlWrapper.css({
329
+ "width": width * 2,
330
+ "left": 0
331
+ });
332
+ base.appendItemsSizes();
333
+ },
334
+
335
+ calculateAll : function () {
336
+ var base = this;
337
+ base.calculateWidth();
338
+ base.appendWrapperSizes();
339
+ base.loops();
340
+ base.max();
341
+ },
342
+
343
+ calculateWidth : function () {
344
+ var base = this;
345
+ base.itemWidth = Math.round(base.$elem.width() / base.options.items);
346
+ },
347
+
348
+ max : function () {
349
+ var base = this,
350
+ maximum = ((base.itemsAmount * base.itemWidth) - base.options.items * base.itemWidth) * -1;
351
+ if (base.options.items > base.itemsAmount) {
352
+ base.maximumItem = 0;
353
+ maximum = 0;
354
+ base.maximumPixels = 0;
355
+ } else {
356
+ base.maximumItem = base.itemsAmount - base.options.items;
357
+ base.maximumPixels = maximum;
358
+ }
359
+ return maximum;
360
+ },
361
+
362
+ min : function () {
363
+ return 0;
364
+ },
365
+
366
+ loops : function () {
367
+ var base = this,
368
+ prev = 0,
369
+ elWidth = 0,
370
+ i,
371
+ item,
372
+ roundPageNum;
373
+
374
+ base.positionsInArray = [0];
375
+ base.pagesInArray = [];
376
+
377
+ for (i = 0; i < base.itemsAmount; i += 1) {
378
+ elWidth += base.itemWidth;
379
+ base.positionsInArray.push(-elWidth);
380
+
381
+ if (base.options.scrollPerPage === true) {
382
+ item = $(base.$owlItems[i]);
383
+ roundPageNum = item.data("owl-roundPages");
384
+ if (roundPageNum !== prev) {
385
+ base.pagesInArray[prev] = base.positionsInArray[i];
386
+ prev = roundPageNum;
387
+ }
388
+ }
389
+ }
390
+ },
391
+
392
+ buildControls : function () {
393
+ var base = this;
394
+ if (base.options.navigation === true || base.options.pagination === true) {
395
+ base.owlControls = $("<div class=\"owl-controls\"/>").toggleClass("clickable", !base.browser.isTouch).appendTo(base.$elem);
396
+ }
397
+ if (base.options.pagination === true) {
398
+ base.buildPagination();
399
+ }
400
+ if (base.options.navigation === true) {
401
+ base.buildButtons();
402
+ }
403
+ },
404
+
405
+ buildButtons : function () {
406
+ var base = this,
407
+ buttonsWrapper = $("<div class=\"owl-buttons\"/>");
408
+ base.owlControls.append(buttonsWrapper);
409
+
410
+ base.buttonPrev = $("<div/>", {
411
+ "class" : "owl-prev",
412
+ "html" : base.options.navigationText[0] || ""
413
+ });
414
+
415
+ base.buttonNext = $("<div/>", {
416
+ "class" : "owl-next",
417
+ "html" : base.options.navigationText[1] || ""
418
+ });
419
+
420
+ buttonsWrapper
421
+ .append(base.buttonPrev)
422
+ .append(base.buttonNext);
423
+
424
+ buttonsWrapper.on("touchstart.owlControls mousedown.owlControls", "div[class^=\"owl\"]", function (event) {
425
+ event.preventDefault();
426
+ });
427
+
428
+ buttonsWrapper.on("touchend.owlControls mouseup.owlControls", "div[class^=\"owl\"]", function (event) {
429
+ event.preventDefault();
430
+ if ($(this).hasClass("owl-next")) {
431
+ base.next();
432
+ } else {
433
+ base.prev();
434
+ }
435
+ });
436
+ },
437
+
438
+ buildPagination : function () {
439
+ var base = this;
440
+
441
+ base.paginationWrapper = $("<div class=\"owl-pagination\"/>");
442
+ base.owlControls.append(base.paginationWrapper);
443
+
444
+ base.paginationWrapper.on("touchend.owlControls mouseup.owlControls", ".owl-page", function (event) {
445
+ event.preventDefault();
446
+ if (Number($(this).data("owl-page")) !== base.currentItem) {
447
+ base.goTo(Number($(this).data("owl-page")), true);
448
+ }
449
+ });
450
+ },
451
+
452
+ updatePagination : function () {
453
+ var base = this,
454
+ counter,
455
+ lastPage,
456
+ lastItem,
457
+ i,
458
+ paginationButton,
459
+ paginationButtonInner;
460
+
461
+ if (base.options.pagination === false) {
462
+ return false;
463
+ }
464
+
465
+ base.paginationWrapper.html("");
466
+
467
+ counter = 0;
468
+ lastPage = base.itemsAmount - base.itemsAmount % base.options.items;
469
+
470
+ for (i = 0; i < base.itemsAmount; i += 1) {
471
+ if (i % base.options.items === 0) {
472
+ counter += 1;
473
+ if (lastPage === i) {
474
+ lastItem = base.itemsAmount - base.options.items;
475
+ }
476
+ paginationButton = $("<div/>", {
477
+ "class" : "owl-page"
478
+ });
479
+ paginationButtonInner = $("<span></span>", {
480
+ "text": base.options.paginationNumbers === true ? counter : "",
481
+ "class": base.options.paginationNumbers === true ? "owl-numbers" : ""
482
+ });
483
+ paginationButton.append(paginationButtonInner);
484
+
485
+ paginationButton.data("owl-page", lastPage === i ? lastItem : i);
486
+ paginationButton.data("owl-roundPages", counter);
487
+
488
+ base.paginationWrapper.append(paginationButton);
489
+ }
490
+ }
491
+ base.checkPagination();
492
+ },
493
+ checkPagination : function () {
494
+ var base = this;
495
+ if (base.options.pagination === false) {
496
+ return false;
497
+ }
498
+ base.paginationWrapper.find(".owl-page").each(function () {
499
+ if ($(this).data("owl-roundPages") === $(base.$owlItems[base.currentItem]).data("owl-roundPages")) {
500
+ base.paginationWrapper
501
+ .find(".owl-page")
502
+ .removeClass("active");
503
+ $(this).addClass("active");
504
+ }
505
+ });
506
+ },
507
+
508
+ checkNavigation : function () {
509
+ var base = this;
510
+
511
+ if (base.options.navigation === false) {
512
+ return false;
513
+ }
514
+ if (base.options.rewindNav === false) {
515
+ if (base.currentItem === 0 && base.maximumItem === 0) {
516
+ base.buttonPrev.addClass("disabled");
517
+ base.buttonNext.addClass("disabled");
518
+ } else if (base.currentItem === 0 && base.maximumItem !== 0) {
519
+ base.buttonPrev.addClass("disabled");
520
+ base.buttonNext.removeClass("disabled");
521
+ } else if (base.currentItem === base.maximumItem) {
522
+ base.buttonPrev.removeClass("disabled");
523
+ base.buttonNext.addClass("disabled");
524
+ } else if (base.currentItem !== 0 && base.currentItem !== base.maximumItem) {
525
+ base.buttonPrev.removeClass("disabled");
526
+ base.buttonNext.removeClass("disabled");
527
+ }
528
+ }
529
+ },
530
+
531
+ updateControls : function () {
532
+ var base = this;
533
+ base.updatePagination();
534
+ base.checkNavigation();
535
+ if (base.owlControls) {
536
+ if (base.options.items >= base.itemsAmount) {
537
+ base.owlControls.hide();
538
+ } else {
539
+ base.owlControls.show();
540
+ }
541
+ }
542
+ },
543
+
544
+ destroyControls : function () {
545
+ var base = this;
546
+ if (base.owlControls) {
547
+ base.owlControls.remove();
548
+ }
549
+ },
550
+
551
+ next : function (speed) {
552
+ var base = this;
553
+
554
+ if (base.isTransition) {
555
+ return false;
556
+ }
557
+
558
+ base.currentItem += base.options.scrollPerPage === true ? base.options.items : 1;
559
+ if (base.currentItem > base.maximumItem + (base.options.scrollPerPage === true ? (base.options.items - 1) : 0)) {
560
+ if (base.options.rewindNav === true) {
561
+ base.currentItem = 0;
562
+ speed = "rewind";
563
+ } else {
564
+ base.currentItem = base.maximumItem;
565
+ return false;
566
+ }
567
+ }
568
+ base.goTo(base.currentItem, speed);
569
+ },
570
+
571
+ prev : function (speed) {
572
+ var base = this;
573
+
574
+ if (base.isTransition) {
575
+ return false;
576
+ }
577
+
578
+ if (base.options.scrollPerPage === true && base.currentItem > 0 && base.currentItem < base.options.items) {
579
+ base.currentItem = 0;
580
+ } else {
581
+ base.currentItem -= base.options.scrollPerPage === true ? base.options.items : 1;
582
+ }
583
+ if (base.currentItem < 0) {
584
+ if (base.options.rewindNav === true) {
585
+ base.currentItem = base.maximumItem;
586
+ speed = "rewind";
587
+ } else {
588
+ base.currentItem = 0;
589
+ return false;
590
+ }
591
+ }
592
+ base.goTo(base.currentItem, speed);
593
+ },
594
+
595
+ goTo : function (position, speed, drag) {
596
+ var base = this,
597
+ goToPixel;
598
+
599
+ if (base.isTransition) {
600
+ return false;
601
+ }
602
+ if (typeof base.options.beforeMove === "function") {
603
+ base.options.beforeMove.apply(this, [base.$elem]);
604
+ }
605
+ if (position >= base.maximumItem) {
606
+ position = base.maximumItem;
607
+ } else if (position <= 0) {
608
+ position = 0;
609
+ }
610
+
611
+ base.currentItem = base.owl.currentItem = position;
612
+ if (base.options.transitionStyle !== false && drag !== "drag" && base.options.items === 1 && base.browser.support3d === true) {
613
+ base.swapSpeed(0);
614
+ if (base.browser.support3d === true) {
615
+ base.transition3d(base.positionsInArray[position]);
616
+ } else {
617
+ base.css2slide(base.positionsInArray[position], 1);
618
+ }
619
+ base.afterGo();
620
+ base.singleItemTransition();
621
+ return false;
622
+ }
623
+ goToPixel = base.positionsInArray[position];
624
+
625
+ if (base.browser.support3d === true) {
626
+ base.isCss3Finish = false;
627
+
628
+ if (speed === true) {
629
+ base.swapSpeed("paginationSpeed");
630
+ window.setTimeout(function () {
631
+ base.isCss3Finish = true;
632
+ }, base.options.paginationSpeed);
633
+
634
+ } else if (speed === "rewind") {
635
+ base.swapSpeed(base.options.rewindSpeed);
636
+ window.setTimeout(function () {
637
+ base.isCss3Finish = true;
638
+ }, base.options.rewindSpeed);
639
+
640
+ } else {
641
+ base.swapSpeed("slideSpeed");
642
+ window.setTimeout(function () {
643
+ base.isCss3Finish = true;
644
+ }, base.options.slideSpeed);
645
+ }
646
+ base.transition3d(goToPixel);
647
+ } else {
648
+ if (speed === true) {
649
+ base.css2slide(goToPixel, base.options.paginationSpeed);
650
+ } else if (speed === "rewind") {
651
+ base.css2slide(goToPixel, base.options.rewindSpeed);
652
+ } else {
653
+ base.css2slide(goToPixel, base.options.slideSpeed);
654
+ }
655
+ }
656
+ base.afterGo();
657
+ },
658
+
659
+ jumpTo : function (position) {
660
+ var base = this;
661
+ if (typeof base.options.beforeMove === "function") {
662
+ base.options.beforeMove.apply(this, [base.$elem]);
663
+ }
664
+ if (position >= base.maximumItem || position === -1) {
665
+ position = base.maximumItem;
666
+ } else if (position <= 0) {
667
+ position = 0;
668
+ }
669
+ base.swapSpeed(0);
670
+ if (base.browser.support3d === true) {
671
+ base.transition3d(base.positionsInArray[position]);
672
+ } else {
673
+ base.css2slide(base.positionsInArray[position], 1);
674
+ }
675
+ base.currentItem = base.owl.currentItem = position;
676
+ base.afterGo();
677
+ },
678
+
679
+ afterGo : function () {
680
+ var base = this;
681
+
682
+ base.prevArr.push(base.currentItem);
683
+ base.prevItem = base.owl.prevItem = base.prevArr[base.prevArr.length - 2];
684
+ base.prevArr.shift(0);
685
+
686
+ if (base.prevItem !== base.currentItem) {
687
+ base.checkPagination();
688
+ base.checkNavigation();
689
+ base.eachMoveUpdate();
690
+
691
+ if (base.options.autoPlay !== false) {
692
+ base.checkAp();
693
+ }
694
+ }
695
+ if (typeof base.options.afterMove === "function" && base.prevItem !== base.currentItem) {
696
+ base.options.afterMove.apply(this, [base.$elem]);
697
+ }
698
+ },
699
+
700
+ stop : function () {
701
+ var base = this;
702
+ base.apStatus = "stop";
703
+ window.clearInterval(base.autoPlayInterval);
704
+ },
705
+
706
+ checkAp : function () {
707
+ var base = this;
708
+ if (base.apStatus !== "stop") {
709
+ base.play();
710
+ }
711
+ },
712
+
713
+ play : function () {
714
+ var base = this;
715
+ base.apStatus = "play";
716
+ if (base.options.autoPlay === false) {
717
+ return false;
718
+ }
719
+ window.clearInterval(base.autoPlayInterval);
720
+ base.autoPlayInterval = window.setInterval(function () {
721
+ base.next(true);
722
+ }, base.options.autoPlay);
723
+ },
724
+
725
+ swapSpeed : function (action) {
726
+ var base = this;
727
+ if (action === "slideSpeed") {
728
+ base.$owlWrapper.css(base.addCssSpeed(base.options.slideSpeed));
729
+ } else if (action === "paginationSpeed") {
730
+ base.$owlWrapper.css(base.addCssSpeed(base.options.paginationSpeed));
731
+ } else if (typeof action !== "string") {
732
+ base.$owlWrapper.css(base.addCssSpeed(action));
733
+ }
734
+ },
735
+
736
+ addCssSpeed : function (speed) {
737
+ return {
738
+ "-webkit-transition": "all " + speed + "ms ease",
739
+ "-moz-transition": "all " + speed + "ms ease",
740
+ "-o-transition": "all " + speed + "ms ease",
741
+ "transition": "all " + speed + "ms ease"
742
+ };
743
+ },
744
+
745
+ removeTransition : function () {
746
+ return {
747
+ "-webkit-transition": "",
748
+ "-moz-transition": "",
749
+ "-o-transition": "",
750
+ "transition": ""
751
+ };
752
+ },
753
+
754
+ doTranslate : function (pixels) {
755
+ return {
756
+ "-webkit-transform": "translate3d(" + pixels + "px, 0px, 0px)",
757
+ "-moz-transform": "translate3d(" + pixels + "px, 0px, 0px)",
758
+ "-o-transform": "translate3d(" + pixels + "px, 0px, 0px)",
759
+ "-ms-transform": "translate3d(" + pixels + "px, 0px, 0px)",
760
+ "transform": "translate3d(" + pixels + "px, 0px,0px)"
761
+ };
762
+ },
763
+
764
+ transition3d : function (value) {
765
+ var base = this;
766
+ base.$owlWrapper.css(base.doTranslate(value));
767
+ },
768
+
769
+ css2move : function (value) {
770
+ var base = this;
771
+ base.$owlWrapper.css({"left" : value});
772
+ },
773
+
774
+ css2slide : function (value, speed) {
775
+ var base = this;
776
+
777
+ base.isCssFinish = false;
778
+ base.$owlWrapper.stop(true, true).animate({
779
+ "left" : value
780
+ }, {
781
+ duration : speed || base.options.slideSpeed,
782
+ complete : function () {
783
+ base.isCssFinish = true;
784
+ }
785
+ });
786
+ },
787
+
788
+ checkBrowser : function () {
789
+ var base = this,
790
+ translate3D = "translate3d(0px, 0px, 0px)",
791
+ tempElem = document.createElement("div"),
792
+ regex,
793
+ asSupport,
794
+ support3d,
795
+ isTouch;
796
+
797
+ tempElem.style.cssText = " -moz-transform:" + translate3D +
798
+ "; -ms-transform:" + translate3D +
799
+ "; -o-transform:" + translate3D +
800
+ "; -webkit-transform:" + translate3D +
801
+ "; transform:" + translate3D;
802
+ regex = /translate3d\(0px, 0px, 0px\)/g;
803
+ asSupport = tempElem.style.cssText.match(regex);
804
+ support3d = (asSupport !== null && asSupport.length === 1);
805
+
806
+ isTouch = "ontouchstart" in window || window.navigator.msMaxTouchPoints;
807
+
808
+ base.browser = {
809
+ "support3d" : support3d,
810
+ "isTouch" : isTouch
811
+ };
812
+ },
813
+
814
+ moveEvents : function () {
815
+ var base = this;
816
+ if (base.options.mouseDrag !== false || base.options.touchDrag !== false) {
817
+ base.gestures();
818
+ base.disabledEvents();
819
+ }
820
+ },
821
+
822
+ eventTypes : function () {
823
+ var base = this,
824
+ types = ["s", "e", "x"];
825
+
826
+ base.ev_types = {};
827
+
828
+ if (base.options.mouseDrag === true && base.options.touchDrag === true) {
829
+ types = [
830
+ "touchstart.owl mousedown.owl",
831
+ "touchmove.owl mousemove.owl",
832
+ "touchend.owl touchcancel.owl mouseup.owl"
833
+ ];
834
+ } else if (base.options.mouseDrag === false && base.options.touchDrag === true) {
835
+ types = [
836
+ "touchstart.owl",
837
+ "touchmove.owl",
838
+ "touchend.owl touchcancel.owl"
839
+ ];
840
+ } else if (base.options.mouseDrag === true && base.options.touchDrag === false) {
841
+ types = [
842
+ "mousedown.owl",
843
+ "mousemove.owl",
844
+ "mouseup.owl"
845
+ ];
846
+ }
847
+
848
+ base.ev_types.start = types[0];
849
+ base.ev_types.move = types[1];
850
+ base.ev_types.end = types[2];
851
+ },
852
+
853
+ disabledEvents : function () {
854
+ var base = this;
855
+ base.$elem.on("dragstart.owl", function (event) { event.preventDefault(); });
856
+ base.$elem.on("mousedown.disableTextSelect", function (e) {
857
+ return $(e.target).is('input, textarea, select, option');
858
+ });
859
+ },
860
+
861
+ gestures : function () {
862
+ /*jslint unparam: true*/
863
+ var base = this,
864
+ locals = {
865
+ offsetX : 0,
866
+ offsetY : 0,
867
+ baseElWidth : 0,
868
+ relativePos : 0,
869
+ position: null,
870
+ minSwipe : null,
871
+ maxSwipe: null,
872
+ sliding : null,
873
+ dargging: null,
874
+ targetElement : null
875
+ };
876
+
877
+ base.isCssFinish = true;
878
+
879
+ function getTouches(event) {
880
+ if (event.touches !== undefined) {
881
+ return {
882
+ x : event.touches[0].pageX,
883
+ y : event.touches[0].pageY
884
+ };
885
+ }
886
+
887
+ if (event.touches === undefined) {
888
+ if (event.pageX !== undefined) {
889
+ return {
890
+ x : event.pageX,
891
+ y : event.pageY
892
+ };
893
+ }
894
+ if (event.pageX === undefined) {
895
+ return {
896
+ x : event.clientX,
897
+ y : event.clientY
898
+ };
899
+ }
900
+ }
901
+ }
902
+
903
+ function swapEvents(type) {
904
+ if (type === "on") {
905
+ $(document).on(base.ev_types.move, dragMove);
906
+ $(document).on(base.ev_types.end, dragEnd);
907
+ } else if (type === "off") {
908
+ $(document).off(base.ev_types.move);
909
+ $(document).off(base.ev_types.end);
910
+ }
911
+ }
912
+
913
+ function dragStart(event) {
914
+ var ev = event.originalEvent || event || window.event,
915
+ position;
916
+
917
+ if (ev.which === 3) {
918
+ return false;
919
+ }
920
+ if (base.itemsAmount <= base.options.items) {
921
+ return;
922
+ }
923
+ if (base.isCssFinish === false && !base.options.dragBeforeAnimFinish) {
924
+ return false;
925
+ }
926
+ if (base.isCss3Finish === false && !base.options.dragBeforeAnimFinish) {
927
+ return false;
928
+ }
929
+
930
+ if (base.options.autoPlay !== false) {
931
+ window.clearInterval(base.autoPlayInterval);
932
+ }
933
+
934
+ if (base.browser.isTouch !== true && !base.$owlWrapper.hasClass("grabbing")) {
935
+ base.$owlWrapper.addClass("grabbing");
936
+ }
937
+
938
+ base.newPosX = 0;
939
+ base.newRelativeX = 0;
940
+
941
+ $(this).css(base.removeTransition());
942
+
943
+ position = $(this).position();
944
+ locals.relativePos = position.left;
945
+
946
+ locals.offsetX = getTouches(ev).x - position.left;
947
+ locals.offsetY = getTouches(ev).y - position.top;
948
+
949
+ swapEvents("on");
950
+
951
+ locals.sliding = false;
952
+ locals.targetElement = ev.target || ev.srcElement;
953
+ }
954
+
955
+ function dragMove(event) {
956
+ var ev = event.originalEvent || event || window.event,
957
+ minSwipe,
958
+ maxSwipe;
959
+
960
+ base.newPosX = getTouches(ev).x - locals.offsetX;
961
+ base.newPosY = getTouches(ev).y - locals.offsetY;
962
+ base.newRelativeX = base.newPosX - locals.relativePos;
963
+
964
+ if (typeof base.options.startDragging === "function" && locals.dragging !== true && base.newRelativeX !== 0) {
965
+ locals.dragging = true;
966
+ base.options.startDragging.apply(base, [base.$elem]);
967
+ }
968
+
969
+ if ((base.newRelativeX > 8 || base.newRelativeX < -8) && (base.browser.isTouch === true)) {
970
+ if (ev.preventDefault !== undefined) {
971
+ ev.preventDefault();
972
+ } else {
973
+ ev.returnValue = false;
974
+ }
975
+ locals.sliding = true;
976
+ }
977
+
978
+ if ((base.newPosY > 10 || base.newPosY < -10) && locals.sliding === false) {
979
+ $(document).off("touchmove.owl");
980
+ }
981
+
982
+ minSwipe = function () {
983
+ return base.newRelativeX / 5;
984
+ };
985
+
986
+ maxSwipe = function () {
987
+ return base.maximumPixels + base.newRelativeX / 5;
988
+ };
989
+
990
+ base.newPosX = Math.max(Math.min(base.newPosX, minSwipe()), maxSwipe());
991
+ if (base.browser.support3d === true) {
992
+ base.transition3d(base.newPosX);
993
+ } else {
994
+ base.css2move(base.newPosX);
995
+ }
996
+ }
997
+
998
+ function dragEnd(event) {
999
+ var ev = event.originalEvent || event || window.event,
1000
+ newPosition,
1001
+ handlers,
1002
+ owlStopEvent;
1003
+
1004
+ ev.target = ev.target || ev.srcElement;
1005
+
1006
+ locals.dragging = false;
1007
+
1008
+ if (base.browser.isTouch !== true) {
1009
+ base.$owlWrapper.removeClass("grabbing");
1010
+ }
1011
+
1012
+ if (base.newRelativeX < 0) {
1013
+ base.dragDirection = base.owl.dragDirection = "left";
1014
+ } else {
1015
+ base.dragDirection = base.owl.dragDirection = "right";
1016
+ }
1017
+
1018
+ if (base.newRelativeX !== 0) {
1019
+ newPosition = base.getNewPosition();
1020
+ base.goTo(newPosition, false, "drag");
1021
+ if (locals.targetElement === ev.target && base.browser.isTouch !== true) {
1022
+ $(ev.target).on("click.disable", function (ev) {
1023
+ ev.stopImmediatePropagation();
1024
+ ev.stopPropagation();
1025
+ ev.preventDefault();
1026
+ $(ev.target).off("click.disable");
1027
+ });
1028
+ handlers = $._data(ev.target, "events").click;
1029
+ owlStopEvent = handlers.pop();
1030
+ handlers.splice(0, 0, owlStopEvent);
1031
+ }
1032
+ }
1033
+ swapEvents("off");
1034
+ }
1035
+ base.$elem.on(base.ev_types.start, ".owl-wrapper", dragStart);
1036
+ },
1037
+
1038
+ getNewPosition : function () {
1039
+ var base = this,
1040
+ newPosition = base.closestItem();
1041
+
1042
+ if (newPosition > base.maximumItem) {
1043
+ base.currentItem = base.maximumItem;
1044
+ newPosition = base.maximumItem;
1045
+ } else if (base.newPosX >= 0) {
1046
+ newPosition = 0;
1047
+ base.currentItem = 0;
1048
+ }
1049
+ return newPosition;
1050
+ },
1051
+ closestItem : function () {
1052
+ var base = this,
1053
+ array = base.options.scrollPerPage === true ? base.pagesInArray : base.positionsInArray,
1054
+ goal = base.newPosX,
1055
+ closest = null;
1056
+
1057
+ $.each(array, function (i, v) {
1058
+ if (goal - (base.itemWidth / 20) > array[i + 1] && goal - (base.itemWidth / 20) < v && base.moveDirection() === "left") {
1059
+ closest = v;
1060
+ if (base.options.scrollPerPage === true) {
1061
+ base.currentItem = $.inArray(closest, base.positionsInArray);
1062
+ } else {
1063
+ base.currentItem = i;
1064
+ }
1065
+ } else if (goal + (base.itemWidth / 20) < v && goal + (base.itemWidth / 20) > (array[i + 1] || array[i] - base.itemWidth) && base.moveDirection() === "right") {
1066
+ if (base.options.scrollPerPage === true) {
1067
+ closest = array[i + 1] || array[array.length - 1];
1068
+ base.currentItem = $.inArray(closest, base.positionsInArray);
1069
+ } else {
1070
+ closest = array[i + 1];
1071
+ base.currentItem = i + 1;
1072
+ }
1073
+ }
1074
+ });
1075
+ return base.currentItem;
1076
+ },
1077
+
1078
+ moveDirection : function () {
1079
+ var base = this,
1080
+ direction;
1081
+ if (base.newRelativeX < 0) {
1082
+ direction = "right";
1083
+ base.playDirection = "next";
1084
+ } else {
1085
+ direction = "left";
1086
+ base.playDirection = "prev";
1087
+ }
1088
+ return direction;
1089
+ },
1090
+
1091
+ customEvents : function () {
1092
+ /*jslint unparam: true*/
1093
+ var base = this;
1094
+ base.$elem.on("owl.next", function () {
1095
+ base.next();
1096
+ });
1097
+ base.$elem.on("owl.prev", function () {
1098
+ base.prev();
1099
+ });
1100
+ base.$elem.on("owl.play", function (event, speed) {
1101
+ base.options.autoPlay = speed;
1102
+ base.play();
1103
+ base.hoverStatus = "play";
1104
+ });
1105
+ base.$elem.on("owl.stop", function () {
1106
+ base.stop();
1107
+ base.hoverStatus = "stop";
1108
+ });
1109
+ base.$elem.on("owl.goTo", function (event, item) {
1110
+ base.goTo(item);
1111
+ });
1112
+ base.$elem.on("owl.jumpTo", function (event, item) {
1113
+ base.jumpTo(item);
1114
+ });
1115
+ },
1116
+
1117
+ stopOnHover : function () {
1118
+ var base = this;
1119
+ if (base.options.stopOnHover === true && base.browser.isTouch !== true && base.options.autoPlay !== false) {
1120
+ base.$elem.on("mouseover", function () {
1121
+ base.stop();
1122
+ });
1123
+ base.$elem.on("mouseout", function () {
1124
+ if (base.hoverStatus !== "stop") {
1125
+ base.play();
1126
+ }
1127
+ });
1128
+ }
1129
+ },
1130
+
1131
+ lazyLoad : function () {
1132
+ var base = this,
1133
+ i,
1134
+ $item,
1135
+ itemNumber,
1136
+ $lazyImg,
1137
+ follow;
1138
+
1139
+ if (base.options.lazyLoad === false) {
1140
+ return false;
1141
+ }
1142
+ for (i = 0; i < base.itemsAmount; i += 1) {
1143
+ $item = $(base.$owlItems[i]);
1144
+
1145
+ if ($item.data("owl-loaded") === "loaded") {
1146
+ continue;
1147
+ }
1148
+
1149
+ itemNumber = $item.data("owl-item");
1150
+ $lazyImg = $item.find(".lazyOwl");
1151
+
1152
+ if (typeof $lazyImg.data("src") !== "string") {
1153
+ $item.data("owl-loaded", "loaded");
1154
+ continue;
1155
+ }
1156
+ if ($item.data("owl-loaded") === undefined) {
1157
+ $lazyImg.hide();
1158
+ $item.addClass("loading").data("owl-loaded", "checked");
1159
+ }
1160
+ if (base.options.lazyFollow === true) {
1161
+ follow = itemNumber >= base.currentItem;
1162
+ } else {
1163
+ follow = true;
1164
+ }
1165
+ if (follow && itemNumber < base.currentItem + base.options.items && $lazyImg.length) {
1166
+ base.lazyPreload($item, $lazyImg);
1167
+ }
1168
+ }
1169
+ },
1170
+
1171
+ lazyPreload : function ($item, $lazyImg) {
1172
+ var base = this,
1173
+ iterations = 0,
1174
+ isBackgroundImg;
1175
+
1176
+ if ($lazyImg.prop("tagName") === "DIV") {
1177
+ $lazyImg.css("background-image", "url(" + $lazyImg.data("src") + ")");
1178
+ isBackgroundImg = true;
1179
+ } else {
1180
+ $lazyImg[0].src = $lazyImg.data("src");
1181
+ }
1182
+
1183
+ function showImage() {
1184
+ $item.data("owl-loaded", "loaded").removeClass("loading");
1185
+ $lazyImg.removeAttr("data-src");
1186
+ if (base.options.lazyEffect === "fade") {
1187
+ $lazyImg.fadeIn(400);
1188
+ } else {
1189
+ $lazyImg.show();
1190
+ }
1191
+ if (typeof base.options.afterLazyLoad === "function") {
1192
+ base.options.afterLazyLoad.apply(this, [base.$elem]);
1193
+ }
1194
+ }
1195
+
1196
+ function checkLazyImage() {
1197
+ iterations += 1;
1198
+ if (base.completeImg($lazyImg.get(0)) || isBackgroundImg === true) {
1199
+ showImage();
1200
+ } else if (iterations <= 100) {//if image loads in less than 10 seconds
1201
+ window.setTimeout(checkLazyImage, 100);
1202
+ } else {
1203
+ showImage();
1204
+ }
1205
+ }
1206
+
1207
+ checkLazyImage();
1208
+ },
1209
+
1210
+ autoHeight : function () {
1211
+ var base = this,
1212
+ $currentimg = $(base.$owlItems[base.currentItem]).find("img"),
1213
+ iterations;
1214
+
1215
+ function addHeight() {
1216
+ var $currentItem = $(base.$owlItems[base.currentItem]).height();
1217
+ base.wrapperOuter.css("height", $currentItem + "px");
1218
+ if (!base.wrapperOuter.hasClass("autoHeight")) {
1219
+ window.setTimeout(function () {
1220
+ base.wrapperOuter.addClass("autoHeight");
1221
+ }, 0);
1222
+ }
1223
+ }
1224
+
1225
+ function checkImage() {
1226
+ iterations += 1;
1227
+ if (base.completeImg($currentimg.get(0))) {
1228
+ addHeight();
1229
+ } else if (iterations <= 100) { //if image loads in less than 10 seconds
1230
+ window.setTimeout(checkImage, 100);
1231
+ } else {
1232
+ base.wrapperOuter.css("height", ""); //Else remove height attribute
1233
+ }
1234
+ }
1235
+
1236
+ if ($currentimg.get(0) !== undefined) {
1237
+ iterations = 0;
1238
+ checkImage();
1239
+ } else {
1240
+ addHeight();
1241
+ }
1242
+ },
1243
+
1244
+ completeImg : function (img) {
1245
+ var naturalWidthType;
1246
+
1247
+ if (!img.complete) {
1248
+ return false;
1249
+ }
1250
+ naturalWidthType = typeof img.naturalWidth;
1251
+ if (naturalWidthType !== "undefined" && img.naturalWidth === 0) {
1252
+ return false;
1253
+ }
1254
+ return true;
1255
+ },
1256
+
1257
+ onVisibleItems : function () {
1258
+ var base = this,
1259
+ i;
1260
+
1261
+ if (base.options.addClassActive === true) {
1262
+ base.$owlItems.removeClass("active");
1263
+ }
1264
+ base.visibleItems = [];
1265
+ for (i = base.currentItem; i < base.currentItem + base.options.items; i += 1) {
1266
+ base.visibleItems.push(i);
1267
+
1268
+ if (base.options.addClassActive === true) {
1269
+ $(base.$owlItems[i]).addClass("active");
1270
+ }
1271
+ }
1272
+ base.owl.visibleItems = base.visibleItems;
1273
+ },
1274
+
1275
+ transitionTypes : function (className) {
1276
+ var base = this;
1277
+ //Currently available: "fade", "backSlide", "goDown", "fadeUp"
1278
+ base.outClass = "owl-" + className + "-out";
1279
+ base.inClass = "owl-" + className + "-in";
1280
+ },
1281
+
1282
+ singleItemTransition : function () {
1283
+ var base = this,
1284
+ outClass = base.outClass,
1285
+ inClass = base.inClass,
1286
+ $currentItem = base.$owlItems.eq(base.currentItem),
1287
+ $prevItem = base.$owlItems.eq(base.prevItem),
1288
+ prevPos = Math.abs(base.positionsInArray[base.currentItem]) + base.positionsInArray[base.prevItem],
1289
+ origin = Math.abs(base.positionsInArray[base.currentItem]) + base.itemWidth / 2,
1290
+ animEnd = 'webkitAnimationEnd oAnimationEnd MSAnimationEnd animationend';
1291
+
1292
+ base.isTransition = true;
1248
1293
 
1249
1294
  base.$owlWrapper
1250
- .addClass('owl-origin')
1251
- .css({
1252
- "-webkit-transform-origin" : origin+"px",
1253
- "-moz-perspective-origin" : origin+"px",
1254
- "perspective-origin" : origin+"px"
1255
- });
1256
- function transStyles(prevPos,zindex){
1257
- return {
1258
- "position" : "relative",
1259
- "left" : prevPos+"px"
1260
- };
1261
- }
1262
-
1263
- var animEnd = 'webkitAnimationEnd oAnimationEnd MSAnimationEnd animationend';
1264
-
1265
- $prevItem
1266
- .css(transStyles(prevPos,10))
1267
- .addClass(outClass)
1268
- .on(animEnd, function() {
1269
- base.endPrev = true;
1270
- $prevItem.off(animEnd);
1271
- base.clearTransStyle($prevItem,outClass);
1272
- });
1273
-
1274
- $currentItem
1275
- .addClass(inClass)
1276
- .on(animEnd, function() {
1277
- base.endCurrent = true;
1278
- $currentItem.off(animEnd);
1279
- base.clearTransStyle($currentItem,inClass);
1280
- });
1281
- },
1282
-
1283
- clearTransStyle : function(item,classToRemove){
1284
- var base = this;
1285
- item.css({
1286
- "position" : "",
1287
- "left" : ""
1288
- })
1289
- .removeClass(classToRemove);
1290
- if(base.endPrev && base.endCurrent){
1291
- base.$owlWrapper.removeClass('owl-origin');
1292
- base.endPrev = false;
1293
- base.endCurrent = false;
1294
- base.isTransition = false;
1295
- }
1296
- },
1297
-
1298
- owlStatus : function(){
1299
- var base = this;
1300
- base.owl = {
1301
- "userOptions" : base.userOptions,
1302
- "baseElement" : base.$elem,
1303
- "userItems" : base.$userItems,
1304
- "owlItems" : base.$owlItems,
1305
- "currentItem" : base.currentItem,
1306
- "prevItem" : base.prevItem,
1307
- "visibleItems" : base.visibleItems,
1308
- "isTouch" : base.browser.isTouch,
1309
- "browser" : base.browser,
1310
- "dragDirection" : base.dragDirection
1311
- }
1312
- },
1313
-
1314
- clearEvents : function(){
1315
- var base = this;
1316
- base.$elem.off(".owl owl mousedown.disableTextSelect");
1317
- $(document).off(".owl owl");
1318
- $(window).off("resize", base.resizer);
1319
- },
1320
-
1321
- unWrap : function(){
1322
- var base = this;
1323
- if(base.$elem.children().length !== 0){
1324
- base.$owlWrapper.unwrap();
1325
- base.$userItems.unwrap().unwrap();
1326
- if(base.owlControls){
1327
- base.owlControls.remove();
1328
- }
1329
- }
1330
- base.clearEvents();
1331
- base.$elem
1332
- .attr("style", base.$elem.data("owl-originalStyles") || "")
1333
- .attr("class", base.$elem.data("owl-originalClasses"));
1334
- },
1335
-
1336
- destroy : function(){
1337
- var base = this;
1338
- base.stop();
1339
- clearInterval(base.checkVisible);
1340
- base.unWrap();
1341
- base.$elem.removeData();
1342
- },
1343
-
1344
- reinit : function(newOptions){
1345
- var base = this;
1346
- var options = $.extend({}, base.userOptions, newOptions);
1347
- base.unWrap();
1348
- base.init(options,base.$elem);
1349
- },
1350
-
1351
- addItem : function(htmlString,targetPosition){
1352
- var base = this,
1353
- position;
1354
-
1355
- if(!htmlString){return false}
1356
-
1357
- if(base.$elem.children().length === 0){
1358
- base.$elem.append(htmlString);
1359
- base.setVars();
1360
- return false;
1361
- }
1362
- base.unWrap();
1363
- if(targetPosition === undefined || targetPosition === -1){
1364
- position = -1;
1365
- } else {
1366
- position = targetPosition;
1367
- }
1368
- if(position >= base.$userItems.length || position === -1){
1369
- base.$userItems.eq(-1).after(htmlString)
1370
- } else {
1371
- base.$userItems.eq(position).before(htmlString)
1372
- }
1373
-
1374
- base.setVars();
1375
- },
1376
-
1377
- removeItem : function(targetPosition){
1378
- var base = this,
1379
- position;
1380
-
1381
- if(base.$elem.children().length === 0){return false}
1382
-
1383
- if(targetPosition === undefined || targetPosition === -1){
1384
- position = -1;
1385
- } else {
1386
- position = targetPosition;
1387
- }
1388
-
1389
- base.unWrap();
1390
- base.$userItems.eq(position).remove();
1391
- base.setVars();
1392
- }
1393
-
1394
- };
1395
-
1396
- $.fn.owlCarousel = function( options ){
1397
- return this.each(function() {
1398
- if($(this).data("owl-init") === true){
1399
- return false;
1400
- }
1401
- $(this).data("owl-init", true);
1402
- var carousel = Object.create( Carousel );
1403
- carousel.init( options, this );
1404
- $.data( this, "owlCarousel", carousel );
1405
- });
1406
- };
1407
-
1408
- $.fn.owlCarousel.options = {
1409
-
1410
- items : 5,
1411
- itemsCustom : false,
1412
- itemsDesktop : [1199,4],
1413
- itemsDesktopSmall : [979,3],
1414
- itemsTablet : [768,2],
1415
- itemsTabletSmall : false,
1416
- itemsMobile : [479,1],
1417
- singleItem : false,
1418
- itemsScaleUp : false,
1419
-
1420
- slideSpeed : 200,
1421
- paginationSpeed : 800,
1422
- rewindSpeed : 1000,
1423
-
1424
- autoPlay : false,
1425
- stopOnHover : false,
1426
-
1427
- navigation : false,
1428
- navigationText : ["prev","next"],
1429
- rewindNav : true,
1430
- scrollPerPage : false,
1431
-
1432
- pagination : true,
1433
- paginationNumbers : false,
1434
-
1435
- responsive : true,
1436
- responsiveRefreshRate : 200,
1437
- responsiveBaseWidth : window,
1438
-
1439
-
1440
- baseClass : "owl-carousel",
1441
- theme : "owl-theme",
1442
-
1443
- lazyLoad : false,
1444
- lazyFollow : true,
1445
- lazyEffect : "fade",
1446
-
1447
- autoHeight : false,
1448
-
1449
- jsonPath : false,
1450
- jsonSuccess : false,
1451
-
1452
- dragBeforeAnimFinish : true,
1453
- mouseDrag : true,
1454
- touchDrag : true,
1455
-
1456
- addClassActive : false,
1457
- transitionStyle : false,
1458
-
1459
- beforeUpdate : false,
1460
- afterUpdate : false,
1461
- beforeInit : false,
1462
- afterInit : false,
1463
- beforeMove : false,
1464
- afterMove : false,
1465
- afterAction : false,
1466
- startDragging : false,
1467
- afterLazyLoad: false
1468
-
1469
- };
1470
- })( jQuery, window, document );
1295
+ .addClass('owl-origin')
1296
+ .css({
1297
+ "-webkit-transform-origin" : origin + "px",
1298
+ "-moz-perspective-origin" : origin + "px",
1299
+ "perspective-origin" : origin + "px"
1300
+ });
1301
+ function transStyles(prevPos) {
1302
+ return {
1303
+ "position" : "relative",
1304
+ "left" : prevPos + "px"
1305
+ };
1306
+ }
1307
+
1308
+ $prevItem
1309
+ .css(transStyles(prevPos, 10))
1310
+ .addClass(outClass)
1311
+ .on(animEnd, function () {
1312
+ base.endPrev = true;
1313
+ $prevItem.off(animEnd);
1314
+ base.clearTransStyle($prevItem, outClass);
1315
+ });
1316
+
1317
+ $currentItem
1318
+ .addClass(inClass)
1319
+ .on(animEnd, function () {
1320
+ base.endCurrent = true;
1321
+ $currentItem.off(animEnd);
1322
+ base.clearTransStyle($currentItem, inClass);
1323
+ });
1324
+ },
1325
+
1326
+ clearTransStyle : function (item, classToRemove) {
1327
+ var base = this;
1328
+ item.css({
1329
+ "position" : "",
1330
+ "left" : ""
1331
+ }).removeClass(classToRemove);
1332
+
1333
+ if (base.endPrev && base.endCurrent) {
1334
+ base.$owlWrapper.removeClass('owl-origin');
1335
+ base.endPrev = false;
1336
+ base.endCurrent = false;
1337
+ base.isTransition = false;
1338
+ }
1339
+ },
1340
+
1341
+ owlStatus : function () {
1342
+ var base = this;
1343
+ base.owl = {
1344
+ "userOptions" : base.userOptions,
1345
+ "baseElement" : base.$elem,
1346
+ "userItems" : base.$userItems,
1347
+ "owlItems" : base.$owlItems,
1348
+ "currentItem" : base.currentItem,
1349
+ "prevItem" : base.prevItem,
1350
+ "visibleItems" : base.visibleItems,
1351
+ "isTouch" : base.browser.isTouch,
1352
+ "browser" : base.browser,
1353
+ "dragDirection" : base.dragDirection
1354
+ };
1355
+ },
1356
+
1357
+ clearEvents : function () {
1358
+ var base = this;
1359
+ base.$elem.off(".owl owl mousedown.disableTextSelect");
1360
+ $(document).off(".owl owl");
1361
+ $(window).off("resize", base.resizer);
1362
+ },
1363
+
1364
+ unWrap : function () {
1365
+ var base = this;
1366
+ if (base.$elem.children().length !== 0) {
1367
+ base.$owlWrapper.unwrap();
1368
+ base.$userItems.unwrap().unwrap();
1369
+ if (base.owlControls) {
1370
+ base.owlControls.remove();
1371
+ }
1372
+ }
1373
+ base.clearEvents();
1374
+ base.$elem
1375
+ .attr("style", base.$elem.data("owl-originalStyles") || "")
1376
+ .attr("class", base.$elem.data("owl-originalClasses"));
1377
+ },
1378
+
1379
+ destroy : function () {
1380
+ var base = this;
1381
+ base.stop();
1382
+ window.clearInterval(base.checkVisible);
1383
+ base.unWrap();
1384
+ base.$elem.removeData();
1385
+ },
1386
+
1387
+ reinit : function (newOptions) {
1388
+ var base = this,
1389
+ options = $.extend({}, base.userOptions, newOptions);
1390
+ base.unWrap();
1391
+ base.init(options, base.$elem);
1392
+ },
1393
+
1394
+ addItem : function (htmlString, targetPosition) {
1395
+ var base = this,
1396
+ position;
1397
+
1398
+ if (!htmlString) {return false; }
1399
+
1400
+ if (base.$elem.children().length === 0) {
1401
+ base.$elem.append(htmlString);
1402
+ base.setVars();
1403
+ return false;
1404
+ }
1405
+ base.unWrap();
1406
+ if (targetPosition === undefined || targetPosition === -1) {
1407
+ position = -1;
1408
+ } else {
1409
+ position = targetPosition;
1410
+ }
1411
+ if (position >= base.$userItems.length || position === -1) {
1412
+ base.$userItems.eq(-1).after(htmlString);
1413
+ } else {
1414
+ base.$userItems.eq(position).before(htmlString);
1415
+ }
1416
+
1417
+ base.setVars();
1418
+ },
1419
+
1420
+ removeItem : function (targetPosition) {
1421
+ var base = this,
1422
+ position;
1423
+
1424
+ if (base.$elem.children().length === 0) {
1425
+ return false;
1426
+ }
1427
+ if (targetPosition === undefined || targetPosition === -1) {
1428
+ position = -1;
1429
+ } else {
1430
+ position = targetPosition;
1431
+ }
1432
+
1433
+ base.unWrap();
1434
+ base.$userItems.eq(position).remove();
1435
+ base.setVars();
1436
+ }
1437
+
1438
+ };
1439
+
1440
+ $.fn.owlCarousel = function (options) {
1441
+ return this.each(function () {
1442
+ if ($(this).data("owl-init") === true) {
1443
+ return false;
1444
+ }
1445
+ $(this).data("owl-init", true);
1446
+ var carousel = Object.create(Carousel);
1447
+ carousel.init(options, this);
1448
+ $.data(this, "owlCarousel", carousel);
1449
+ });
1450
+ };
1451
+
1452
+ $.fn.owlCarousel.options = {
1453
+
1454
+ items : 5,
1455
+ itemsCustom : false,
1456
+ itemsDesktop : [1199, 4],
1457
+ itemsDesktopSmall : [979, 3],
1458
+ itemsTablet : [768, 2],
1459
+ itemsTabletSmall : false,
1460
+ itemsMobile : [479, 1],
1461
+ singleItem : false,
1462
+ itemsScaleUp : false,
1463
+
1464
+ slideSpeed : 200,
1465
+ paginationSpeed : 800,
1466
+ rewindSpeed : 1000,
1467
+
1468
+ autoPlay : false,
1469
+ stopOnHover : false,
1470
+
1471
+ navigation : false,
1472
+ navigationText : ["prev", "next"],
1473
+ rewindNav : true,
1474
+ scrollPerPage : false,
1475
+
1476
+ pagination : true,
1477
+ paginationNumbers : false,
1478
+
1479
+ responsive : true,
1480
+ responsiveRefreshRate : 200,
1481
+ responsiveBaseWidth : window,
1482
+
1483
+ baseClass : "owl-carousel",
1484
+ theme : "owl-theme",
1485
+
1486
+ lazyLoad : false,
1487
+ lazyFollow : true,
1488
+ lazyEffect : "fade",
1489
+
1490
+ autoHeight : false,
1491
+
1492
+ jsonPath : false,
1493
+ jsonSuccess : false,
1494
+
1495
+ dragBeforeAnimFinish : true,
1496
+ mouseDrag : true,
1497
+ touchDrag : true,
1498
+
1499
+ addClassActive : false,
1500
+ transitionStyle : false,
1501
+
1502
+ beforeUpdate : false,
1503
+ afterUpdate : false,
1504
+ beforeInit : false,
1505
+ afterInit : false,
1506
+ beforeMove : false,
1507
+ afterMove : false,
1508
+ afterAction : false,
1509
+ startDragging : false,
1510
+ afterLazyLoad: false
1511
+ };
1512
+ }(jQuery, window, document));