1/* 2 * jQuery OwlCarousel v1.31 3 * 4 * Copyright (c) 2013 Bartosz Wojciechowski 5 * http://www.owlgraphic.com/owlcarousel/ 6 * 7 * Licensed under MIT 8 * 9 */ 10 11if ( typeof Object.create !== "function" ) { 12 Object.create = function( obj ) { 13 function F() {}; 14 F.prototype = obj; 15 return new F(); 16 }; 17} 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("bm-owl-originalStyles", base.$elem.attr("style")) 65 .data("bm-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(".bm-owl-item"); 84 base.$owlWrapper = base.$elem.find(".bm-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(".bm-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=\"bm-owl-wrapper\">").wrap("<div class=\"bm-owl-item\"></div>"); 187 base.$elem.find(".bm-owl-wrapper").wrap("<div class=\"bm-owl-wrapper-outer\">"); 188 base.wrapperOuter = base.$elem.find(".bm-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("bm-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("bm-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 345 max : function(){ 346 var base = this; 347 var maximum = ((base.itemsAmount * base.itemWidth) - base.options.items * base.itemWidth) * -1; 348 if(base.options.items > base.itemsAmount){ 349 base.maximumItem = 0; 350 maximum = 0 351 base.maximumPixels = 0; 352 } else { 353 base.maximumItem = base.itemsAmount - base.options.items; 354 base.maximumPixels = maximum; 355 } 356 return maximum; 357 }, 358 359 min : function(){ 360 return 0; 361 }, 362 363 loops : function(){ 364 var base = this; 365 366 base.positionsInArray = [0]; 367 base.pagesInArray = []; 368 var prev = 0; 369 var elWidth = 0; 370 371 for(var i = 0; i<base.itemsAmount; i++){ 372 elWidth += base.itemWidth; 373 base.positionsInArray.push(-elWidth); 374 375 if(base.options.scrollPerPage === true){ 376 var item = $(base.$owlItems[i]); 377 var roundPageNum = item.data("bm-owl-roundPages"); 378 if(roundPageNum !== prev){ 379 base.pagesInArray[prev] = base.positionsInArray[i]; 380 prev = roundPageNum; 381 } 382 } 383 } 384 }, 385 386 buildControls : function(){ 387 var base = this; 388 if(base.options.navigation === true || base.options.pagination === true){ 389 base.owlControls = $("<div class=\"bm-owl-controls\"/>").toggleClass("clickable", !base.browser.isTouch).appendTo(base.$elem); 390 } 391 if(base.options.pagination === true){ 392 base.buildPagination(); 393 } 394 if(base.options.navigation === true){ 395 base.buildButtons(); 396 } 397 }, 398 399 buildButtons : function(){ 400 var base = this; 401 if(base.options.nextButton!='' && base.options.prevButton!='') 402 { 403 $(base.options.nextButton).on('click', function(){ 404 base.next(); 405 }); 406 $(base.options.prevButton).on('click', function(){ 407 base.prev(); 408 }); 409 } 410 else 411 { 412 var buttonsWrapper = $("<div class=\"bm-owl-buttons\"/>") 413 base.owlControls.append(buttonsWrapper); 414 415 base.buttonPrev = $("<div/>",{ 416 "class" : "bm-owl-prev", 417 "html" : base.options.navigationText[0] || "" 418 });
419 420 base.buttonNext = $("<div/>",{ 421 "class" : "bm-owl-next", 422 "html" : base.options.navigationText[1] || "" 423 }); 424 425 buttonsWrapper 426 .append(base.buttonPrev) 427 .append(base.buttonNext); 428 429 buttonsWrapper.on("touchstart.owlControls mousedown.owlControls", "div[class^=\"bm-owl\"]", function(event){ 430 event.preventDefault(); 431 }) 432 433 buttonsWrapper.on("touchend.owlControls mouseup.owlControls", "div[class^=\"bm-owl\"]", function(event){ 434 event.preventDefault(); 435 if($(this).hasClass("bm-owl-next")){ 436 base.next(); 437 } else{ 438 base.prev(); 439 } 440 }) 441 } 442 }, 443 444 buildPagination : function(){ 445 var base = this; 446 if(base.options.pagingButton!='') 447 { 448 var paging_items = $(base.options.pagingButton+" > div"); 449 $.each(paging_items,function(key, val){ 450 $(val).on('click',function(){ 451 base.goTo( key, true); 452 }) 453 }) 454 } 455 else 456 { 457 base.paginationWrapper = $("<div class=\"bm-owl-pagination\"/>"); 458 base.owlControls.append(base.paginationWrapper); 459 460 base.paginationWrapper.on("touchend.owlControls mouseup.owlControls", ".bm-owl-page", function(event){ 461 event.preventDefault(); 462 if(Number($(this).data("bm-owl-page")) !== base.currentItem){ 463 base.goTo( Number($(this).data("bm-owl-page")), true); 464 } 465 }); 466 } 467 }, 468 469 updatePagination : function(){ 470 var base = this; 471 if(base.options.pagingButton=='') 472 { 473 if(base.options.pagination === false){ 474 return false; 475 } 476 477 base.paginationWrapper.html(""); 478 479 var counter = 0; 480 var lastPage = base.itemsAmount - base.itemsAmount % base.options.items; 481 482 for(var i = 0; i<base.itemsAmount; i++){ 483 if(i % base.options.items === 0){ 484 counter +=1; 485 if(lastPage === i){ 486 var lastItem = base.itemsAmount - base.options.items; 487 } 488 var paginationButton = $("<div/>",{ 489 "class" : "bm-owl-page" 490 }); 491 var paginationButtonInner = $("<span></span>",{ 492 "text": base.options.paginationNumbers === true ? counter : "", 493 "class": base.options.paginationNumbers === true ? "bm-owl-numbers" : "" 494 }); 495 paginationButton.append(paginationButtonInner); 496 497 paginationButton.data("bm-owl-page",lastPage === i ? lastItem : i); 498 paginationButton.data("bm-owl-roundPages",counter); 499 500 base.paginationWrapper.append(paginationButton); 501 } 502 } 503 } 504 base.checkPagination(); 505 }, 506 checkPagination : function(){ 507 var base = this; 508 if(base.options.pagination === false){ 509 return false; 510 } 511 if(base.options.pagingButton!='') 512 { 513 var paging_items = $(base.options.pagingButton+" > div"); 514 $.each(paging_items,function(key, val){ 515 if(key==base.currentItem) 516 { 517 paging_items.removeClass('bm_active'); 518 $(val).addClass('bm_active'); 519 } 520 }) 521 } 522 else 523 { 524 base.paginationWrapper.find(".bm-owl-page").each(function(i,v){ 525 if($(this).data("bm-owl-roundPages") === $(base.$owlItems[base.currentItem]).data("bm-owl-roundPages") ){ 526 base.paginationWrapper 527 .find(".bm-owl-page") 528 .removeClass("active"); 529 $(this).addClass("active"); 530 } 531 }); 532 } 533 }, 534 535 checkNavigation : function(){ 536 var base = this; 537 538 if(base.options.navigation === false){ 539 return false; 540 } 541 if(base.options.rewindNav === false){ 542 if(base.currentItem === 0 && base.maximumItem === 0){ 543 base.buttonPrev.addClass("disabled"); 544 base.buttonNext.addClass("disabled"); 545 } else if(base.currentItem === 0 && base.maximumItem !== 0){ 546 base.buttonPrev.addClass("disabled"); 547 base.buttonNext.removeClass("disabled"); 548 } else if (base.currentItem === base.maximumItem){ 549 base.buttonPrev.removeClass("disabled"); 550 base.buttonNext.addClass("disabled"); 551 } else if(base.currentItem !== 0 && base.currentItem !== base.maximumItem){ 552 base.buttonPrev.removeClass("disabled"); 553 base.buttonNext.removeClass("disabled"); 554 } 555 } 556 }, 557 558 updateControls : function(){ 559 var base = this; 560 base.updatePagination(); 561 base.checkNavigation(); 562 if(base.owlControls){ 563 if(base.options.items >= base.itemsAmount){ 564 base.owlControls.hide(); 565 } else { 566 base.owlControls.show(); 567 } 568 } 569 }, 570 571 destroyControls : function(){ 572 var base = this; 573 if(base.owlControls){ 574 base.owlControls.remove(); 575 } 576 }, 577 578 next : function(speed){ 579 var base = this; 580 581 if(base.isTransition){ 582 return false; 583 } 584 585 base.currentItem += base.options.scrollPerPage === true ? base.options.items : 1; 586 if(base.currentItem > base.maximumItem + (base.options.scrollPerPage == true ? (base.options.items - 1) : 0)){ 587 if(base.options.rewindNav === true){ 588 base.currentItem = 0; 589 speed = "rewind"; 590 } else { 591 base.currentItem = base.maximumItem; 592 return false; 593 } 594 } 595 base.goTo(base.currentItem,speed); 596 }, 597 598 prev : function(speed){ 599 var base = this; 600 601 if(base.isTransition){ 602 return false; 603 } 604 605 if(base.options.scrollPerPage === true && base.currentItem > 0 && base.currentItem < base.options.items){ 606 base.currentItem = 0 607 } else { 608 base.currentItem -= base.options.scrollPerPage === true ? base.options.items : 1; 609 } 610 if(base.currentItem < 0){ 611 if(base.options.rewindNav === true){ 612 base.currentItem = base.maximumItem; 613 speed = "rewind" 614 } else { 615 base.currentItem =0; 616 return false; 617 } 618 } 619 base.goTo(base.currentItem,speed); 620 }, 621 622 goTo : function(position,speed,drag){ 623 var base = this; 624 625 if(base.isTransition){ 626 return false; 627 } 628 if(typeof base.options.beforeMove === "function") { 629 base.options.beforeMove.apply(this,[base.$elem]); 630 } 631 if(position >= base.maximumItem){ 632 position = base.maximumItem; 633 } 634 else if( position <= 0 ){ 635 position = 0; 636 } 637 638 base.currentItem = base.owl.currentItem = position; 639 if( base.options.transitionStyle !== false && drag !== "drag" && base.options.items === 1 && base.browser.support3d === true){ 640 base.swapSpeed(0) 641 if(base.browser.support3d === true){ 642 base.transition3d(base.positionsInArray[position]); 643 } else { 644 base.css2slide(base.positionsInArray[position],1); 645 } 646 base.afterGo(); 647 base.singleItemTransition(); 648 649 return false; 650 } 651 var goToPixel = base.positionsInArray[position]; 652 653 if(base.browser.support3d === true){ 654 base.isCss3Finish = false; 655 656 if(speed === true){ 657 base.swapSpeed("paginationSpeed"); 658 setTimeout(function() { 659 base.isCss3Finish = true; 660 }, base.options.paginationSpeed); 661 662 } else if(speed === "rewind" ){ 663 base.swapSpeed(base.options.rewindSpeed); 664 setTimeout(function() { 665 base.isCss3Finish = true; 666 }, base.options.rewindSpeed); 667 668 } else { 669 base.swapSpeed("slideSpeed"); 670 setTimeout(function() { 671 base.isCss3Finish = true; 672 }, base.options.slideSpeed); 673 } 674 base.transition3d(goToPixel); 675 } else { 676 if(speed === true){
677 base.css2slide(goToPixel, base.options.paginationSpeed); 678 } else if(speed === "rewind" ){ 679 base.css2slide(goToPixel, base.options.rewindSpeed); 680 } else { 681 base.css2slide(goToPixel, base.options.slideSpeed); 682 } 683 } 684 base.afterGo(); 685 }, 686 687 jumpTo : function(position){ 688 var base = this; 689 if(typeof base.options.beforeMove === "function") { 690 base.options.beforeMove.apply(this,[base.$elem]); 691 } 692 if(position >= base.maximumItem || position === -1){ 693 position = base.maximumItem; 694 } 695 else if( position <= 0 ){ 696 position = 0; 697 } 698 base.swapSpeed(0) 699 if(base.browser.support3d === true){ 700 base.transition3d(base.positionsInArray[position]); 701 } else { 702 base.css2slide(base.positionsInArray[position],1); 703 } 704 base.currentItem = base.owl.currentItem = position; 705 base.afterGo(); 706 }, 707 708 afterGo : function(){ 709 var base = this; 710 711 base.prevArr.push(base.currentItem); 712 base.prevItem = base.owl.prevItem = base.prevArr[base.prevArr.length -2]; 713 base.prevArr.shift(0) 714 715 if(base.prevItem !== base.currentItem){ 716 base.checkPagination(); 717 base.checkNavigation(); 718 base.eachMoveUpdate(); 719 720 if(base.options.autoPlay !== false){ 721 base.checkAp(); 722 } 723 } 724 if(typeof base.options.afterMove === "function" && base.prevItem !== base.currentItem) { 725 base.options.afterMove.apply(this,[base.$elem]); 726 } 727 }, 728 729 stop : function(){ 730 var base = this; 731 base.apStatus = "stop"; 732 clearInterval(base.autoPlayInterval); 733 }, 734 735 checkAp : function(){ 736 var base = this; 737 if(base.apStatus !== "stop"){ 738 base.play(); 739 } 740 }, 741 742 play : function(){ 743 var base = this; 744 base.apStatus = "play"; 745 if(base.options.autoPlay === false){ 746 return false; 747 } 748 clearInterval(base.autoPlayInterval); 749 base.autoPlayInterval = setInterval(function(){ 750 base.next(true); 751 },base.options.autoPlay); 752 }, 753 754 swapSpeed : function(action){ 755 var base = this; 756 if(action === "slideSpeed"){ 757 base.$owlWrapper.css(base.addCssSpeed(base.options.slideSpeed)); 758 } else if(action === "paginationSpeed" ){ 759 base.$owlWrapper.css(base.addCssSpeed(base.options.paginationSpeed)); 760 } else if(typeof action !== "string"){ 761 base.$owlWrapper.css(base.addCssSpeed(action)); 762 } 763 }, 764 765 addCssSpeed : function(speed){ 766 var base = this; 767 return { 768 "-webkit-transition": "all "+ speed +"ms ease", 769 "-moz-transition": "all "+ speed +"ms ease", 770 "-o-transition": "all "+ speed +"ms ease", 771 "transition": "all "+ speed +"ms ease" 772 }; 773 }, 774 775 removeTransition : function(){ 776 return { 777 "-webkit-transition": "", 778 "-moz-transition": "", 779 "-o-transition": "", 780 "transition": "" 781 }; 782 }, 783 784 doTranslate : function(pixels){ 785 return { 786 "-webkit-transform": "translate3d("+pixels+"px, 0px, 0px)", 787 "-moz-transform": "translate3d("+pixels+"px, 0px, 0px)", 788 "-o-transform": "translate3d("+pixels+"px, 0px, 0px)", 789 "-ms-transform": "translate3d("+pixels+"px, 0px, 0px)", 790 "transform": "translate3d("+pixels+"px, 0px,0px)" 791 }; 792 }, 793 794 transition3d : function(value){ 795 var base = this; 796 base.$owlWrapper.css(base.doTranslate(value)); 797 }, 798 799 css2move : function(value){ 800 var base = this; 801 base.$owlWrapper.css({"left" : value}) 802 }, 803 804 css2slide : function(value,speed){ 805 var base = this; 806 807 base.isCssFinish = false; 808 base.$owlWrapper.stop(true,true).animate({ 809 "left" : value 810 }, { 811 duration : speed || base.options.slideSpeed , 812 complete : function(){ 813 base.isCssFinish = true; 814 } 815 }); 816 }, 817 818 checkBrowser : function(){ 819 var base = this; 820 821 //Check 3d support 822 var translate3D = "translate3d(0px, 0px, 0px)", 823 tempElem = document.createElement("div"); 824 825 tempElem.style.cssText= " -moz-transform:" + translate3D + 826 "; -ms-transform:" + translate3D + 827 "; -o-transform:" + translate3D + 828 "; -webkit-transform:" + translate3D + 829 "; transform:" + translate3D; 830 var regex = /translate3d\(0px, 0px, 0px\)/g, 831 asSupport = tempElem.style.cssText.match(regex), 832 support3d = (asSupport !== null && asSupport.length === 1); 833 834 var isTouch = "ontouchstart" in window || navigator.msMaxTouchPoints; 835 836 base.browser = { 837 "support3d" : support3d, 838 "isTouch" : isTouch 839 } 840 }, 841 842 moveEvents : function(){ 843 var base = this; 844 if(base.options.mouseDrag !== false || base.options.touchDrag !== false){ 845 base.gestures(); 846 base.disabledEvents(); 847 } 848 }, 849 850 eventTypes : function(){ 851 var base = this; 852 var types = ["s","e","x"]; 853 854 base.ev_types = {}; 855 856 if(base.options.mouseDrag === true && base.options.touchDrag === true){ 857 types = [ 858 "touchstart.owl mousedown.owl", 859 "touchmove.owl mousemove.owl", 860 "touchend.owl touchcancel.owl mouseup.owl" 861 ]; 862 } else if(base.options.mouseDrag === false && base.options.touchDrag === true){ 863 types = [ 864 "touchstart.owl", 865 "touchmove.owl", 866 "touchend.owl touchcancel.owl" 867 ]; 868 } else if(base.options.mouseDrag === true && base.options.touchDrag === false){ 869 types = [ 870 "mousedown.owl", 871 "mousemove.owl", 872 "mouseup.owl" 873 ]; 874 } 875 876 base.ev_types["start"] = types[0]; 877 base.ev_types["move"] = types[1]; 878 base.ev_types["end"] = types[2]; 879 }, 880 881 disabledEvents : function(){ 882 var base = this; 883 base.$elem.on("dragstart.owl", function(event) { event.preventDefault();}); 884 base.$elem.on("mousedown.disableTextSelect", function(e) { 885 return $(e.target).is('input, textarea, select, option'); 886 }); 887 }, 888 889 gestures : function(){ 890 var base = this; 891 892 var locals = { 893 offsetX : 0, 894 offsetY : 0, 895 baseElWidth : 0, 896 relativePos : 0, 897 position: null, 898 minSwipe : null, 899 maxSwipe: null, 900 sliding : null, 901 dargging: null, 902 targetElement : null 903 } 904 905 base.isCssFinish = true; 906 907 function getTouches(event){ 908 if(event.touches){ 909 return { 910 x : event.touches[0].pageX, 911 y : event.touches[0].pageY 912 } 913 } else { 914 if(event.pageX !== undefined){ 915 return { 916 x : event.pageX, 917 y : event.pageY 918 } 919 } else { 920 return { 921 x : event.clientX, 922 y : event.clientY 923 } 924 } 925 } 926 } 927 928 function swapEvents(type){ 929 if(type === "on"){ 930 $(document).on(base.ev_types["move"], dragMove); 931 $(document).on(base.ev_types["end"], dragEnd); 932 } else if(type === "off"){ 933 $(document).off(base.ev_types["move"]); 934 $(document).off(base.ev_types["end"]); 935 } 936 } 937 938 function dragStart(event) { 939 var event = event.originalEvent || event || window.event; 940 941 if (event.which === 3) { 942 return false; 943 } 944 if(base.itemsAmount <= base.options.items){ 945 return; 946 } 947 if(base.isCssFinish === false && !base.options.dragBeforeAnimFinish ){ 948 return false; 949 } 950 if(base.isCss3Finish === false && !base.options.dragBeforeAnimFinish ){ 951 return false; 952 } 953 954 if(base.options.autoPlay !== false){ 955 clearInterval(base.autoPlayInterval); 956 } 957 958 if(base.browser.isTouch !== true && !base.$owlWrapper.hasClass("grabbing")){ 959 base.$owlWrapper.addClass("grabbing") 960 } 961 962 base.newPosX = 0; 963 base.newRelativeX = 0; 964 965 $(this).css(base.removeTransition()); 966 967 var position = $(this).position(); 968 locals.relativePos = position.left; 969 970 locals.offsetX = getTouches(event).x - position.left; 971 locals.offsetY = getTouches(event).y - position.top; 972 973 swapEvents("on"); 974 975 locals.sliding = false; 976 locals.targetElement = event.target || event.srcElement; 977 } 978 979 function dragMove(event){ 980 var event = event.originalEvent || event || window.event; 981 982 base.newPosX = getTouches(event).x- locals.offsetX; 983 base.newPosY = getTouches(event).y - locals.offsetY; 984 base.newRelativeX = base.newPosX - locals.relativePos; 985 986 if (typeof base.options.startDragging === "function" && locals.dragging !== true && base.newRelativeX !== 0) { 987 locals.dragging = true; 988 base.options.startDragging.apply(base,[base.$elem]); 989 } 990 991 if(base.newRelativeX > 8 || base.newRelativeX < -8 && base.browser.isTouch === true){ 992 event.preventDefault ? event.preventDefault() : event.returnValue = false; 993 locals.sliding = true; 994 } 995 996 if((base.newPosY > 10 || base.newPosY < -10) && locals.sliding === false){ 997 $(document).off("touchmove.owl"); 998 } 999 1000 var minSwipe = function(){ 1001 return base.newRelativeX / 5; 1002 } 1003 var maxSwipe = function(){ 1004 return base.maximumPixels + base.newRelativeX / 5; 1005 } 1006 1007 base.newPosX = Math.max(Math.min( base.newPosX, minSwipe() ), maxSwipe() ); 1008 if(base.browser.support3d === true){ 1009 base.transition3d(base.newPosX); 1010 } else { 1011 base.css2move(base.newPosX); 1012 } 1013 } 1014 1015 function dragEnd(event){ 1016 var event = event.originalEvent || event || window.event; 1017 event.target = event.target || event.srcElement; 1018 1019 locals.dragging = false; 1020 1021 if(base.browser.isTouch !== true){ 1022 base.$owlWrapper.removeClass("grabbing"); 1023 } 1024 1025 if(base.newRelativeX<0){ 1026 base.dragDirection = base.owl.dragDirection = "left" 1027 } else { 1028 base.dragDirection = base.owl.dragDirection = "right" 1029 } 1030 1031 if(base.newRelativeX !== 0){ 1032 var newPosition = base.getNewPosition(); 1033 base.goTo(newPosition,false,"drag"); 1034 if(locals.targetElement === event.target && base.browser.isTouch !== true){ 1035 $(event.target).on("click.disable", function(ev){ 1036 ev.stopImmediatePropagation(); 1037 ev.stopPropagation(); 1038 ev.preventDefault(); 1039 $(event.target).off("click.disable"); 1040 });
1041 var handlers = $._data(event.target, "events")["click"]; 1042 var owlStopEvent = handlers.pop(); 1043 handlers.splice(0, 0, owlStopEvent); 1044 } 1045 } 1046 swapEvents("off"); 1047 } 1048 base.$elem.on(base.ev_types["start"], ".bm-owl-wrapper", dragStart); 1049 }, 1050 1051 getNewPosition : function(){ 1052 var base = this, 1053 newPosition; 1054 1055 newPosition = base.closestItem(); 1056 1057 if(newPosition>base.maximumItem){ 1058 base.currentItem = base.maximumItem; 1059 newPosition = base.maximumItem; 1060 } else if( base.newPosX >=0 ){ 1061 newPosition = 0; 1062 base.currentItem = 0; 1063 } 1064 return newPosition; 1065 }, 1066 closestItem : function(){ 1067 var base = this, 1068 array = base.options.scrollPerPage === true ? base.pagesInArray : base.positionsInArray, 1069 goal = base.newPosX, 1070 closest = null; 1071 1072 $.each(array, function(i,v){ 1073 if( goal - (base.itemWidth/20) > array[i+1] && goal - (base.itemWidth/20)< v && base.moveDirection() === "left") { 1074 closest = v; 1075 if(base.options.scrollPerPage === true){ 1076 base.currentItem = $.inArray(closest, base.positionsInArray); 1077 } else { 1078 base.currentItem = i; 1079 } 1080 } 1081 else if (goal + (base.itemWidth/20) < v && goal + (base.itemWidth/20) > (array[i+1] || array[i]-base.itemWidth) && base.moveDirection() === "right"){ 1082 if(base.options.scrollPerPage === true){ 1083 closest = array[i+1] || array[array.length-1]; 1084 base.currentItem = $.inArray(closest, base.positionsInArray); 1085 } else { 1086 closest = array[i+1]; 1087 base.currentItem = i+1; 1088 } 1089 } 1090 }); 1091 return base.currentItem; 1092 }, 1093 1094 moveDirection : function(){ 1095 var base = this, 1096 direction; 1097 if(base.newRelativeX < 0 ){ 1098 direction = "right" 1099 base.playDirection = "next" 1100 } else { 1101 direction = "left" 1102 base.playDirection = "prev" 1103 } 1104 return direction 1105 }, 1106 1107 customEvents : function(){ 1108 var base = this; 1109 base.$elem.on("owl.next",function(){ 1110 base.next(); 1111 }); 1112 base.$elem.on("owl.prev",function(){ 1113 base.prev(); 1114 }); 1115 base.$elem.on("owl.play",function(event,speed){ 1116 base.options.autoPlay = speed; 1117 base.play(); 1118 base.hoverStatus = "play"; 1119 }); 1120 base.$elem.on("owl.stop",function(){ 1121 base.stop(); 1122 base.hoverStatus = "stop"; 1123 }); 1124 base.$elem.on("owl.goTo",function(event,item){ 1125 base.goTo(item) 1126 }); 1127 base.$elem.on("owl.jumpTo",function(event,item){ 1128 base.jumpTo(item) 1129 }); 1130 }, 1131 1132 stopOnHover : function(){ 1133 var base = this; 1134 if(base.options.stopOnHover === true && base.browser.isTouch !== true && base.options.autoPlay !== false){ 1135 base.$elem.on("mouseover", function(){ 1136 base.stop(); 1137 }); 1138 base.$elem.on("mouseout", function(){ 1139 if(base.hoverStatus !== "stop"){ 1140 base.play(); 1141 } 1142 }); 1143 } 1144 }, 1145 1146 lazyLoad : function(){ 1147 var base = this; 1148 1149 if(base.options.lazyLoad === false){ 1150 return false; 1151 } 1152 for(var i=0; i<base.itemsAmount; i++){ 1153 var $item = $(base.$owlItems[i]); 1154 1155 if($item.data("bm-owl-loaded") === "loaded"){ 1156 continue; 1157 } 1158 1159 var itemNumber = $item.data("bm-owl-item"), 1160 $lazyImg = $item.find(".lazyOwl"), 1161 follow; 1162 1163 if( typeof $lazyImg.data("src") !== "string"){ 1164 $item.data("bm-owl-loaded","loaded"); 1165 continue; 1166 } 1167 if($item.data("bm-owl-loaded") === undefined){ 1168 $lazyImg.hide(); 1169 $item.addClass("loading").data("bm-owl-loaded","checked"); 1170 } 1171 if(base.options.lazyFollow === true){ 1172 follow = itemNumber >= base.currentItem; 1173 } else { 1174 follow = true; 1175 } 1176 if(follow && itemNumber < base.currentItem + base.options.items && $lazyImg.length){ 1177 base.lazyPreload($item,$lazyImg); 1178 } 1179 } 1180 }, 1181 1182 lazyPreload : function($item,$lazyImg){ 1183 var base = this, 1184 iterations = 0; 1185 if ($lazyImg.prop("tagName") === "DIV") { 1186 $lazyImg.css("background-image", "url(" + $lazyImg.data("src")+ ")" ); 1187 var isBackgroundImg=true; 1188 } else { 1189 $lazyImg[0].src = $lazyImg.data("src"); 1190 } 1191 checkLazyImage(); 1192 1193 function checkLazyImage(){ 1194 iterations += 1;
1195 if (base.completeImg($lazyImg.get(0)) || isBackgroundImg === true) { 1196 showImage(); 1197 } else if(iterations <= 100){//if image loads in less than 10 seconds 1198 setTimeout(checkLazyImage,100); 1199 } else { 1200 showImage(); 1201 } 1202 } 1203 function showImage(){ 1204 $item.data("bm-owl-loaded", "loaded").removeClass("loading"); 1205 $lazyImg.removeAttr("data-src"); 1206 base.options.lazyEffect === "fade" ? $lazyImg.fadeIn(400) : $lazyImg.show(); 1207 if(typeof base.options.afterLazyLoad === "function") { 1208 base.options.afterLazyLoad.apply(this,[base.$elem]); 1209 } 1210 } 1211 }, 1212 1213 autoHeight : function(){ 1214 var base = this; 1215 var $currentimg = $(base.$owlItems[base.currentItem]).find("img"); 1216 1217 if($currentimg.get(0) !== undefined ){ 1218 var iterations = 0; 1219 checkImage(); 1220 } else { 1221 addHeight(); 1222 } 1223 function checkImage(){ 1224 iterations += 1; 1225 if ( base.completeImg($currentimg.get(0)) ) { 1226 addHeight(); 1227 } else if(iterations <= 100){ //if image loads in less than 10 seconds 1228 setTimeout(checkImage,100); 1229 } else { 1230 base.wrapperOuter.css("height", ""); //Else remove height attribute 1231 } 1232 } 1233 1234 function addHeight(){ 1235 var $currentItem = $(base.$owlItems[base.currentItem]).height(); 1236 base.wrapperOuter.css("height",$currentItem+"px"); 1237 if(!base.wrapperOuter.hasClass("autoHeight")){ 1238 setTimeout(function(){ 1239 base.wrapperOuter.addClass("autoHeight"); 1240 },0); 1241 } 1242 } 1243 }, 1244 1245 completeImg : function(img) { 1246 if (!img.complete) { 1247 return false; 1248 } 1249 if (typeof img.naturalWidth !== "undefined" && img.naturalWidth == 0) { 1250 return false; 1251 } 1252 return true; 1253 }, 1254 1255 onVisibleItems : function(){ 1256 var base = this; 1257 1258 if(base.options.addClassActive === true){ 1259 base.$owlItems.removeClass("active"); 1260 } 1261 base.visibleItems = []; 1262 for(var i=base.currentItem; i<base.currentItem + base.options.items; i++){ 1263 base.visibleItems.push(i); 1264 1265 if(base.options.addClassActive === true){ 1266 $(base.$owlItems[i]).addClass("active"); 1267 } 1268 } 1269 base.owl.visibleItems = base.visibleItems; 1270 }, 1271 1272 transitionTypes : function(className){ 1273 var base = this; 1274 //Currently available: "fade","backSlide","goDown","fadeUp" 1275 base.outClass = "bm-owl-"+className+"-out"; 1276 base.inClass = "bm-owl-"+className+"-in"; 1277 }, 1278 1279 singleItemTransition : function(){ 1280 var base = this; 1281 base.isTransition = true; 1282 1283 var outClass = base.outClass, 1284 inClass = base.inClass, 1285 $currentItem = base.$owlItems.eq(base.currentItem), 1286 $prevItem = base.$owlItems.eq(base.prevItem), 1287 prevPos = Math.abs(base.positionsInArray[base.currentItem]) + base.positionsInArray[base.prevItem], 1288 origin = Math.abs(base.positionsInArray[base.currentItem])+base.itemWidth/2; 1289 1290 base.$owlWrapper 1291 .addClass('bm-owl-origin') 1292 .css({ 1293 "-webkit-transform-origin" : origin+"px", 1294 "-moz-perspective-origin" : origin+"px", 1295 "perspective-origin" : origin+"px" 1296 }); 1297 function transStyles(prevPos,zindex){ 1298 return { 1299 "position" : "relative", 1300 "left" : prevPos+"px" 1301 }; 1302 } 1303 1304 var animEnd = 'webkitAnimationEnd oAnimationEnd MSAnimationEnd animationend'; 1305 1306 $prevItem 1307 .css(transStyles(prevPos,10)) 1308 .addClass(outClass) 1309 .on(animEnd, function() { 1310 base.endPrev = true; 1311 $prevItem.off(animEnd); 1312 base.clearTransStyle($prevItem,outClass); 1313 }); 1314 1315 $currentItem 1316 .addClass(inClass) 1317 .on(animEnd, function() { 1318 base.endCurrent = true; 1319 $currentItem.off(animEnd); 1320 base.clearTransStyle($currentItem,inClass); 1321 }); 1322 }, 1323 1324 clearTransStyle : function(item,classToRemove){ 1325 var base = this; 1326 item.css({ 1327 "position" : "", 1328 "left" : "" 1329 }) 1330 .removeClass(classToRemove); 1331 if(base.endPrev && base.endCurrent){ 1332 base.$owlWrapper.removeClass('bm-owl-origin'); 1333 base.endPrev = false; 1334 base.endCurrent = false; 1335 base.isTransition = false; 1336 } 1337 }, 1338 1339 owlStatus : function(){ 1340 var base = this; 1341 base.owl = { 1342 "userOptions" : base.userOptions, 1343 "baseElement" : base.$elem, 1344 "userItems" : base.$userItems, 1345 "owlItems" : base.$owlItems, 1346 "currentItem" : base.currentItem, 1347 "prevItem" : base.prevItem, 1348 "visibleItems" : base.visibleItems, 1349 "isTouch" : base.browser.isTouch, 1350 "browser" : base.browser,
1351 "dragDirection" : base.dragDirection 1352 } 1353 }, 1354 1355 clearEvents : function(){ 1356 var base = this; 1357 base.$elem.off(".owl owl mousedown.disableTextSelect"); 1358 $(document).off(".owl owl"); 1359 $(window).off("resize", base.resizer); 1360 }, 1361 1362 unWrap : function(){ 1363 var base = this; 1364 if(base.$elem.children().length !== 0){ 1365 base.$owlWrapper.unwrap(); 1366 base.$userItems.unwrap().unwrap(); 1367 if(base.owlControls){ 1368 base.owlControls.remove(); 1369 } 1370 } 1371 base.clearEvents(); 1372 base.$elem 1373 .attr("style", base.$elem.data("bm-owl-originalStyles") || "") 1374 .attr("class", base.$elem.data("bm-owl-originalClasses")); 1375 }, 1376 1377 destroy : function(){ 1378 var base = this; 1379 base.stop(); 1380 clearInterval(base.checkVisible); 1381 base.unWrap(); 1382 base.$elem.removeData(); 1383 }, 1384 1385 reinit : function(newOptions){ 1386 var base = this; 1387 var options = $.extend({}, base.userOptions, newOptions); 1388 base.unWrap(); 1389 base.init(options,base.$elem); 1390 }, 1391 1392 addItem : function(htmlString,targetPosition){ 1393 var base = this, 1394 position; 1395 1396 if(!htmlString){return false} 1397 1398 if(base.$elem.children().length === 0){ 1399 base.$elem.append(htmlString); 1400 base.setVars(); 1401 return false; 1402 } 1403 base.unWrap(); 1404 if(targetPosition === undefined || targetPosition === -1){ 1405 position = -1; 1406 } else { 1407 position = targetPosition; 1408 } 1409 if(position >= base.$userItems.length || position === -1){ 1410 base.$userItems.eq(-1).after(htmlString) 1411 } else { 1412 base.$userItems.eq(position).before(htmlString) 1413 } 1414 1415 base.setVars(); 1416 }, 1417 1418 removeItem : function(targetPosition){ 1419 var base = this, 1420 position; 1421 1422 if(base.$elem.children().length === 0){return false} 1423 1424 if(targetPosition === undefined || targetPosition === -1){ 1425 position = -1; 1426 } else { 1427 position = targetPosition; 1428 } 1429 1430 base.unWrap(); 1431 base.$userItems.eq(position).remove(); 1432 base.setVars(); 1433 } 1434 1435 }; 1436 1437 $.fn.owlCarousel = function( options ){ 1438 return this.each(function() { 1439 if($(this).data("bm-owl-init") === true){ 1440 return false; 1441 } 1442 $(this).data("bm-owl-init", true); 1443 var carousel = Object.create( Carousel ); 1444 carousel.init( options, this ); 1445 $.data( this, "owlCarousel", carousel ); 1446 }); 1447 }; 1448 1449 $.fn.owlCarousel.options = { 1450 1451 items : 5, 1452 itemsCustom : false, 1453 itemsDesktop : [1199,4], 1454 itemsDesktopSmall : [979,3], 1455 itemsTablet : [768,2], 1456 itemsTabletSmall : false, 1457 itemsMobile : [479,1], 1458 singleItem : false, 1459 itemsScaleUp : false, 1460 1461 slideSpeed : 200, 1462 paginationSpeed : 800, 1463 rewindSpeed : 1000, 1464 1465 autoPlay : false, 1466 stopOnHover : false, 1467 1468 navigation : false, 1469 navigationText : ["prev","next"], 1470 nextButton:'', 1471 prevButton:'', 1472 pagingButton:'', 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 1484 baseClass : "bm-owl-carousel", 1485 theme : "bm-owl-theme", 1486 1487 lazyLoad : false, 1488 lazyFollow : true, 1489 lazyEffect : "fade", 1490 1491 autoHeight : false, 1492 1493 jsonPath : false, 1494 jsonSuccess : false, 1495 1496 dragBeforeAnimFinish : true, 1497 mouseDrag : true, 1498 touchDrag : true, 1499 1500 addClassActive : false, 1501 transitionStyle : false, 1502 1503 beforeUpdate : false, 1504 afterUpdate : false, 1505 beforeInit : false, 1506 afterInit : false, 1507 beforeMove : false, 1508 afterMove : false, 1509 afterAction : false, 1510 startDragging : false, 1511 afterLazyLoad: false 1512 1513 }; 1514})( jQuery, window, document );
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.