Преглед на файлове

Try to fix some responsive issues on Vegas in a div

Jay Salvat преди 5 години
родител
ревизия
b55d59421c
променени са 8 файла, в които са добавени 1390 реда и са изтрити 1455 реда
  1. 61 122
      dist/vegas.css
  2. 664 666
      dist/vegas.js
  3. 0 0
      dist/vegas.min.css
  4. 0 0
      dist/vegas.min.css.map
  5. 2 2
      dist/vegas.min.js
  6. 0 0
      dist/vegas.min.js.map
  7. 1 1
      gulpfile.js
  8. 662 664
      src/vegas.js

+ 61 - 122
dist/vegas.css

@@ -41,8 +41,7 @@
     margin: 0;
     padding: 0;
     background: transparent center center no-repeat;
-    -webkit-transform: translateZ(0);
-            transform: translateZ(0);
+    transform: translateZ(0);
     will-change: transform, opacity;
 }
 
@@ -184,19 +183,16 @@ body.vegas-container > .vegas-slide {
 /*******************************************/
 .vegas-transition-slideDown,
 .vegas-transition-slideDown2 {
-    -webkit-transform: translateY(-100%);
-            transform: translateY(-100%);
+    transform: translateY(-100%);
 }
 
 .vegas-transition-slideDown-in,
 .vegas-transition-slideDown2-in {
-    -webkit-transform: translateY(0%);
-            transform: translateY(0%);
+    transform: translateY(0%);
 }
 
 .vegas-transition-slideDown2-out {
-    -webkit-transform: translateY(100%);
-            transform: translateY(100%);
+    transform: translateY(100%);
 }
 
 /*******************************************/
@@ -204,19 +200,16 @@ body.vegas-container > .vegas-slide {
 /*******************************************/
 .vegas-transition-slideLeft,
 .vegas-transition-slideLeft2 {
-    -webkit-transform: translateX(100%);
-            transform: translateX(100%);
+    transform: translateX(100%);
 }
 
 .vegas-transition-slideLeft-in,
 .vegas-transition-slideLeft2-in {
-    -webkit-transform: translateX(0%);
-            transform: translateX(0%);
+    transform: translateX(0%);
 }
 
 .vegas-transition-slideLeft2-out {
-    -webkit-transform: translateX(-100%);
-            transform: translateX(-100%);
+    transform: translateX(-100%);
 }
 
 /*******************************************/
@@ -224,19 +217,16 @@ body.vegas-container > .vegas-slide {
 /*******************************************/
 .vegas-transition-slideRight,
 .vegas-transition-slideRight2 {
-    -webkit-transform: translateX(-100%);
-            transform: translateX(-100%);
+    transform: translateX(-100%);
 }
 
 .vegas-transition-slideRight-in,
 .vegas-transition-slideRight2-in {
-    -webkit-transform: translateX(0%);
-            transform: translateX(0%);
+    transform: translateX(0%);
 }
 
 .vegas-transition-slideRight2-out {
-    -webkit-transform: translateX(100%);
-            transform: translateX(100%);
+    transform: translateX(100%);
 }
 
 /*******************************************/
@@ -244,19 +234,16 @@ body.vegas-container > .vegas-slide {
 /*******************************************/
 .vegas-transition-slideUp,
 .vegas-transition-slideUp2 {
-    -webkit-transform: translateY(100%);
-            transform: translateY(100%);
+    transform: translateY(100%);
 }
 
 .vegas-transition-slideUp-in,
 .vegas-transition-slideUp2-in {
-    -webkit-transform: translateY(0%);
-            transform: translateY(0%);
+    transform: translateY(0%);
 }
 
 .vegas-transition-slideUp2-out {
-    -webkit-transform: translateY(-100%);
-            transform: translateY(-100%);
+    transform: translateY(-100%);
 }
 
 /*******************************************/
@@ -264,21 +251,18 @@ body.vegas-container > .vegas-slide {
 /*******************************************/
 .vegas-transition-swirlLeft,
 .vegas-transition-swirlLeft2 {
-    -webkit-transform: scale(2) rotate(35deg);
-            transform: scale(2) rotate(35deg);
+    transform: scale(2) rotate(35deg);
     opacity: 0;
 }
 
 .vegas-transition-swirlLeft-in,
 .vegas-transition-swirlLeft2-in {
-    -webkit-transform: scale(1) rotate(0deg);
-            transform: scale(1) rotate(0deg);
+    transform: scale(1) rotate(0deg);
     opacity: 1;
 }
 
 .vegas-transition-swirlLeft2-out {
-    -webkit-transform: scale(2) rotate(-35deg);
-            transform: scale(2) rotate(-35deg);
+    transform: scale(2) rotate(-35deg);
     opacity: 0;
 }
 
@@ -287,21 +271,18 @@ body.vegas-container > .vegas-slide {
 /*******************************************/
 .vegas-transition-swirlRight,
 .vegas-transition-swirlRight2 {
-    -webkit-transform: scale(2) rotate(-35deg);
-            transform: scale(2) rotate(-35deg);
+    transform: scale(2) rotate(-35deg);
     opacity: 0;
 }
 
 .vegas-transition-swirlRight-in,
 .vegas-transition-swirlRight2-in {
-    -webkit-transform: scale(1) rotate(0deg);
-            transform: scale(1) rotate(0deg);
+    transform: scale(1) rotate(0deg);
     opacity: 1;
 }
 
 .vegas-transition-swirlRight2-out {
-    -webkit-transform: scale(2) rotate(35deg);
-            transform: scale(2) rotate(35deg);
+    transform: scale(2) rotate(35deg);
     opacity: 0;
 }
 
@@ -310,21 +291,18 @@ body.vegas-container > .vegas-slide {
 /*******************************************/
 .vegas-transition-zoomIn,
 .vegas-transition-zoomIn2 {
-    -webkit-transform: scale(0);
-            transform: scale(0);
+    transform: scale(0);
     opacity: 0;
 }
 
 .vegas-transition-zoomIn-in,
 .vegas-transition-zoomIn2-in {
-    -webkit-transform: scale(1);
-            transform: scale(1);
+    transform: scale(1);
     opacity: 1;
 }
 
 .vegas-transition-zoomIn2-out {
-    -webkit-transform: scale(2);
-            transform: scale(2);
+    transform: scale(2);
     opacity: 0;
 }
 
@@ -333,21 +311,18 @@ body.vegas-container > .vegas-slide {
 /*******************************************/
 .vegas-transition-zoomOut,
 .vegas-transition-zoomOut2 {
-    -webkit-transform: scale(2);
-            transform: scale(2);
+    transform: scale(2);
     opacity: 0;
 }
 
 .vegas-transition-zoomOut-in,
 .vegas-transition-zoomOut2-in {
-    -webkit-transform: scale(1);
-            transform: scale(1);
+    transform: scale(1);
     opacity: 1;
 }
 
 .vegas-transition-zoomOut2-out {
-    -webkit-transform: scale(0);
-            transform: scale(0);
+    transform: scale(0);
     opacity: 0;
 }
 
@@ -361,23 +336,19 @@ body.vegas-container > .vegas-slide {
 
 @-webkit-keyframes kenburns {
     0% {
-        -webkit-transform: scale(1.5);
-                transform: scale(1.5);
+        transform: scale(1.5);
     }
     100% {
-        -webkit-transform: scale(1);
-                transform: scale(1);
+        transform: scale(1);
     }
 }
 
 @keyframes kenburns {
     0% {
-        -webkit-transform: scale(1.5);
-                transform: scale(1.5);
+        transform: scale(1.5);
     }
     100% {
-        -webkit-transform: scale(1);
-                transform: scale(1);
+        transform: scale(1);
     }
 }
 
@@ -391,23 +362,19 @@ body.vegas-container > .vegas-slide {
 
 @-webkit-keyframes kenburnsDownLeft {
     0% {
-        -webkit-transform: scale(1.5) translate(10%, -10%);
-                transform: scale(1.5) translate(10%, -10%);
+        transform: scale(1.5) translate(10%, -10%);
     }
     100% {
-        -webkit-transform: scale(1) translate(0, 0);
-                transform: scale(1) translate(0, 0);
+        transform: scale(1) translate(0, 0);
     }
 }
 
 @keyframes kenburnsDownLeft {
     0% {
-        -webkit-transform: scale(1.5) translate(10%, -10%);
-                transform: scale(1.5) translate(10%, -10%);
+        transform: scale(1.5) translate(10%, -10%);
     }
     100% {
-        -webkit-transform: scale(1) translate(0, 0);
-                transform: scale(1) translate(0, 0);
+        transform: scale(1) translate(0, 0);
     }
 }
 
@@ -421,23 +388,19 @@ body.vegas-container > .vegas-slide {
 
 @-webkit-keyframes kenburnsDownRight {
     0% {
-        -webkit-transform: scale(1.5) translate(-10%, -10%);
-                transform: scale(1.5) translate(-10%, -10%);
+        transform: scale(1.5) translate(-10%, -10%);
     }
     100% {
-        -webkit-transform: scale(1) translate(0, 0);
-                transform: scale(1) translate(0, 0);
+        transform: scale(1) translate(0, 0);
     }
 }
 
 @keyframes kenburnsDownRight {
     0% {
-        -webkit-transform: scale(1.5) translate(-10%, -10%);
-                transform: scale(1.5) translate(-10%, -10%);
+        transform: scale(1.5) translate(-10%, -10%);
     }
     100% {
-        -webkit-transform: scale(1) translate(0, 0);
-                transform: scale(1) translate(0, 0);
+        transform: scale(1) translate(0, 0);
     }
 }
 
@@ -451,23 +414,19 @@ body.vegas-container > .vegas-slide {
 
 @-webkit-keyframes kenburnsDown {
     0% {
-        -webkit-transform: scale(1.5) translate(0, -10%);
-                transform: scale(1.5) translate(0, -10%);
+        transform: scale(1.5) translate(0, -10%);
     }
     100% {
-        -webkit-transform: scale(1) translate(0, 0);
-                transform: scale(1) translate(0, 0);
+        transform: scale(1) translate(0, 0);
     }
 }
 
 @keyframes kenburnsDown {
     0% {
-        -webkit-transform: scale(1.5) translate(0, -10%);
-                transform: scale(1.5) translate(0, -10%);
+        transform: scale(1.5) translate(0, -10%);
     }
     100% {
-        -webkit-transform: scale(1) translate(0, 0);
-                transform: scale(1) translate(0, 0);
+        transform: scale(1) translate(0, 0);
     }
 }
 
@@ -481,23 +440,19 @@ body.vegas-container > .vegas-slide {
 
 @-webkit-keyframes kenburnsLeft {
     0% {
-        -webkit-transform: scale(1.5) translate(10%, 0);
-                transform: scale(1.5) translate(10%, 0);
+        transform: scale(1.5) translate(10%, 0);
     }
     100% {
-        -webkit-transform: scale(1) translate(0, 0);
-                transform: scale(1) translate(0, 0);
+        transform: scale(1) translate(0, 0);
     }
 }
 
 @keyframes kenburnsLeft {
     0% {
-        -webkit-transform: scale(1.5) translate(10%, 0);
-                transform: scale(1.5) translate(10%, 0);
+        transform: scale(1.5) translate(10%, 0);
     }
     100% {
-        -webkit-transform: scale(1) translate(0, 0);
-                transform: scale(1) translate(0, 0);
+        transform: scale(1) translate(0, 0);
     }
 }
 
@@ -511,23 +466,19 @@ body.vegas-container > .vegas-slide {
 
 @-webkit-keyframes kenburnsRight {
     0% {
-        -webkit-transform: scale(1.5) translate(-10%, 0);
-                transform: scale(1.5) translate(-10%, 0);
+        transform: scale(1.5) translate(-10%, 0);
     }
     100% {
-        -webkit-transform: scale(1) translate(0, 0);
-                transform: scale(1) translate(0, 0);
+        transform: scale(1) translate(0, 0);
     }
 }
 
 @keyframes kenburnsRight {
     0% {
-        -webkit-transform: scale(1.5) translate(-10%, 0);
-                transform: scale(1.5) translate(-10%, 0);
+        transform: scale(1.5) translate(-10%, 0);
     }
     100% {
-        -webkit-transform: scale(1) translate(0, 0);
-                transform: scale(1) translate(0, 0);
+        transform: scale(1) translate(0, 0);
     }
 }
 
@@ -541,23 +492,19 @@ body.vegas-container > .vegas-slide {
 
 @-webkit-keyframes kenburnsUpLeft {
     0% {
-        -webkit-transform: scale(1.5) translate(10%, 10%);
-                transform: scale(1.5) translate(10%, 10%);
+        transform: scale(1.5) translate(10%, 10%);
     }
     100% {
-        -webkit-transform: scale(1) translate(0, 0);
-                transform: scale(1) translate(0, 0);
+        transform: scale(1) translate(0, 0);
     }
 }
 
 @keyframes kenburnsUpLeft {
     0% {
-        -webkit-transform: scale(1.5) translate(10%, 10%);
-                transform: scale(1.5) translate(10%, 10%);
+        transform: scale(1.5) translate(10%, 10%);
     }
     100% {
-        -webkit-transform: scale(1) translate(0, 0);
-                transform: scale(1) translate(0, 0);
+        transform: scale(1) translate(0, 0);
     }
 }
 
@@ -571,23 +518,19 @@ body.vegas-container > .vegas-slide {
 
 @-webkit-keyframes kenburnsUpRight {
     0% {
-        -webkit-transform: scale(1.5) translate(-10%, 10%);
-                transform: scale(1.5) translate(-10%, 10%);
+        transform: scale(1.5) translate(-10%, 10%);
     }
     100% {
-        -webkit-transform: scale(1) translate(0, 0);
-                transform: scale(1) translate(0, 0);
+        transform: scale(1) translate(0, 0);
     }
 }
 
 @keyframes kenburnsUpRight {
     0% {
-        -webkit-transform: scale(1.5) translate(-10%, 10%);
-                transform: scale(1.5) translate(-10%, 10%);
+        transform: scale(1.5) translate(-10%, 10%);
     }
     100% {
-        -webkit-transform: scale(1) translate(0, 0);
-                transform: scale(1) translate(0, 0);
+        transform: scale(1) translate(0, 0);
     }
 }
 
@@ -601,22 +544,18 @@ body.vegas-container > .vegas-slide {
 
 @-webkit-keyframes kenburnsUp {
     0% {
-        -webkit-transform: scale(1.5) translate(0, 10%);
-                transform: scale(1.5) translate(0, 10%);
+        transform: scale(1.5) translate(0, 10%);
     }
     100% {
-        -webkit-transform: scale(1) translate(0, 0);
-                transform: scale(1) translate(0, 0);
+        transform: scale(1) translate(0, 0);
     }
 }
 
 @keyframes kenburnsUp {
     0% {
-        -webkit-transform: scale(1.5) translate(0, 10%);
-                transform: scale(1.5) translate(0, 10%);
+        transform: scale(1.5) translate(0, 10%);
     }
     100% {
-        -webkit-transform: scale(1) translate(0, 0);
-                transform: scale(1) translate(0, 0);
+        transform: scale(1) translate(0, 0);
     }
 }

+ 664 - 666
dist/vegas.js

@@ -1,751 +1,749 @@
 /*!-----------------------------------------------------------------------------
  * Vegas - Fullscreen Backgrounds and Slideshows.
- * v2.4.4 - built 2018-10-30
+ * v2.4.4 - built 2020-04-22
  * Licensed under the MIT License.
  * http://vegas.jaysalvat.com/
  * ----------------------------------------------------------------------------
- * Copyright (C) 2010-2018 Jay Salvat
+ * Copyright (C) 2010-2020 Jay Salvat
  * http://jaysalvat.com/
  * --------------------------------------------------------------------------*/
 
 (function ($) {
-    'use strict';
-
-    var defaults = {
-        slide:                   0,
-        delay:                   5000,
-        loop:                    true,
-        preload:                 false,
-        preloadImage:            false,
-        preloadVideo:            false,
-        timer:                   true,
-        overlay:                 false,
-        autoplay:                true,
-        shuffle:                 false,
-        cover:                   true,
-        color:                   null,
-        align:                   'center',
-        valign:                  'center',
-        firstTransition:         null,
-        firstTransitionDuration: null,
-        transition:              'fade',
-        transitionDuration:      1000,
-        transitionRegister:      [],
-        animation:               null,
-        animationDuration:       'auto',
-        animationRegister:       [],
-        slidesToKeep:            1,
-        init:  function () {},
-        play:  function () {},
-        pause: function () {},
-        walk:  function () {},
-        slides: [
-            // {
-            //  src:                null,
-            //  color:              null,
-            //  delay:              null,
-            //  align:              null,
-            //  valign:             null,
-            //  transition:         null,
-            //  transitionDuration: null,
-            //  animation:          null,
-            //  animationDuration:  null,
-            //  cover:              true,
-            //  video: {
-            //      src: [],
-            //      mute: true,
-            //      loop: true
-            // }
-            // ...
-        ]
+  'use strict';
+
+  var defaults = {
+    slide:                   0,
+    delay:                   5000,
+    loop:                    true,
+    preload:                 false,
+    preloadImage:            false,
+    preloadVideo:            false,
+    timer:                   true,
+    overlay:                 false,
+    autoplay:                true,
+    shuffle:                 false,
+    cover:                   true,
+    color:                   null,
+    align:                   'center',
+    valign:                  'center',
+    firstTransition:         null,
+    firstTransitionDuration: null,
+    transition:              'fade',
+    transitionDuration:      1000,
+    transitionRegister:      [],
+    animation:               null,
+    animationDuration:       'auto',
+    animationRegister:       [],
+    slidesToKeep:            1,
+    init:  function () {},
+    play:  function () {},
+    pause: function () {},
+    walk:  function () {},
+    slides: [
+      // {
+      //  src:                null,
+      //  color:              null,
+      //  delay:              null,
+      //  align:              null,
+      //  valign:             null,
+      //  transition:         null,
+      //  transitionDuration: null,
+      //  animation:          null,
+      //  animationDuration:  null,
+      //  cover:              true,
+      //  video: {
+      //      src: [],
+      //      mute: true,
+      //      loop: true
+      // }
+      // ...
+    ]
+  };
+
+  var videoCache = {};
+
+  var Vegas = function (elmt, options) {
+    this.elmt         = elmt;
+    this.settings     = $.extend({}, defaults, $.vegas.defaults, options);
+    this.slide        = this.settings.slide;
+    this.total        = this.settings.slides.length;
+    this.noshow       = this.total < 2;
+    this.paused       = !this.settings.autoplay || this.noshow;
+    this.ended        = false;
+    this.$elmt        = $(elmt);
+    this.$timer       = null;
+    this.$overlay     = null;
+    this.$slide       = null;
+    this.timeout      = null;
+    this.first        = true;
+
+    this.transitions = [
+      'fade', 'fade2',
+      'blur', 'blur2',
+      'flash', 'flash2',
+      'negative', 'negative2',
+      'burn', 'burn2',
+      'slideLeft', 'slideLeft2',
+      'slideRight', 'slideRight2',
+      'slideUp', 'slideUp2',
+      'slideDown', 'slideDown2',
+      'zoomIn', 'zoomIn2',
+      'zoomOut', 'zoomOut2',
+      'swirlLeft', 'swirlLeft2',
+      'swirlRight', 'swirlRight2'
+    ];
+
+    this.animations = [
+      'kenburns',
+      'kenburnsLeft', 'kenburnsRight',
+      'kenburnsUp', 'kenburnsUpLeft', 'kenburnsUpRight',
+      'kenburnsDown', 'kenburnsDownLeft', 'kenburnsDownRight'
+    ];
+
+    if (this.settings.transitionRegister instanceof Array === false) {
+      this.settings.transitionRegister = [ this.settings.transitionRegister ];
+    }
+
+    if (this.settings.animationRegister instanceof Array === false) {
+      this.settings.animationRegister = [ this.settings.animationRegister ];
+    }
+
+    this.transitions = this.transitions.concat(this.settings.transitionRegister);
+    this.animations  = this.animations.concat(this.settings.animationRegister);
+
+    this.support = {
+      objectFit:  'objectFit'  in document.body.style,
+      transition: 'transition' in document.body.style || 'WebkitTransition' in document.body.style,
+      video:      $.vegas.isVideoCompatible()
     };
 
-    var videoCache = {};
-
-    var Vegas = function (elmt, options) {
-        this.elmt         = elmt;
-        this.settings     = $.extend({}, defaults, $.vegas.defaults, options);
-        this.slide        = this.settings.slide;
-        this.total        = this.settings.slides.length;
-        this.noshow       = this.total < 2;
-        this.paused       = !this.settings.autoplay || this.noshow;
-        this.ended        = false;
-        this.$elmt        = $(elmt);
-        this.$timer       = null;
-        this.$overlay     = null;
-        this.$slide       = null;
-        this.timeout      = null;
-        this.first        = true;
-
-        this.transitions = [
-            'fade', 'fade2',
-            'blur', 'blur2',
-            'flash', 'flash2',
-            'negative', 'negative2',
-            'burn', 'burn2',
-            'slideLeft', 'slideLeft2',
-            'slideRight', 'slideRight2',
-            'slideUp', 'slideUp2',
-            'slideDown', 'slideDown2',
-            'zoomIn', 'zoomIn2',
-            'zoomOut', 'zoomOut2',
-            'swirlLeft', 'swirlLeft2',
-            'swirlRight', 'swirlRight2'
-        ];
-
-        this.animations = [
-            'kenburns',
-            'kenburnsLeft', 'kenburnsRight',
-            'kenburnsUp', 'kenburnsUpLeft', 'kenburnsUpRight',
-            'kenburnsDown', 'kenburnsDownLeft', 'kenburnsDownRight'
-        ];
-
-        if (this.settings.transitionRegister instanceof Array === false) {
-            this.settings.transitionRegister = [ this.settings.transitionRegister ];
+    if (this.settings.shuffle === true) {
+      this.shuffle();
+    }
+
+    this._init();
+  };
+
+  Vegas.prototype = {
+    _init: function () {
+      var $wrapper,
+        $overlay,
+        $timer,
+        isBody  = this.elmt.tagName === 'BODY',
+        timer   = this.settings.timer,
+        overlay = this.settings.overlay,
+        self    = this;
+
+      // Preloading
+      this._preload();
+
+      // Wrapper with content
+      if (!isBody) {
+        $wrapper = $('<div class="vegas-wrapper">')
+          .css('overflow', this.$elmt.css('overflow'))
+          .css('padding',  this.$elmt.css('padding'));
+
+        // Some browsers don't compute padding shorthand
+        if (!this.$elmt.css('padding')) {
+          $wrapper
+            .css('padding-top',    this.$elmt.css('padding-top'))
+            .css('padding-bottom', this.$elmt.css('padding-bottom'))
+            .css('padding-left',   this.$elmt.css('padding-left'))
+            .css('padding-right',  this.$elmt.css('padding-right'));
         }
 
-        if (this.settings.animationRegister instanceof Array === false) {
-            this.settings.animationRegister = [ this.settings.animationRegister ];
-        }
+        this.$elmt.clone(true).children().appendTo($wrapper);
+        this.elmt.innerHTML = '';
+      }
 
-        this.transitions = this.transitions.concat(this.settings.transitionRegister);
-        this.animations  = this.animations.concat(this.settings.animationRegister);
+      // Timer
+      if (timer && this.support.transition) {
+        $timer = $('<div class="vegas-timer"><div class="vegas-timer-progress">');
+        this.$timer = $timer;
+        this.$elmt.prepend($timer);
+      }
 
-        this.support = {
-            objectFit:  'objectFit'  in document.body.style,
-            transition: 'transition' in document.body.style || 'WebkitTransition' in document.body.style,
-            video:      $.vegas.isVideoCompatible()
-        };
+      // Overlay
+      if (overlay) {
+        $overlay = $('<div class="vegas-overlay">');
 
-        if (this.settings.shuffle === true) {
-            this.shuffle();
+        if (typeof overlay === 'string') {
+          $overlay.css('background-image', 'url(' + overlay + ')');
         }
 
-        this._init();
-    };
+        this.$overlay = $overlay;
+        this.$elmt.prepend($overlay);
+      }
 
-    Vegas.prototype = {
-        _init: function () {
-            var $wrapper,
-                $overlay,
-                $timer,
-                isBody  = this.elmt.tagName === 'BODY',
-                timer   = this.settings.timer,
-                overlay = this.settings.overlay,
-                self    = this;
-
-            // Preloading
-            this._preload();
-
-            // Wrapper with content
-            if (!isBody) {
-                this.$elmt.css('height', this.$elmt.css('height'));
-
-                $wrapper = $('<div class="vegas-wrapper">')
-                    .css('overflow', this.$elmt.css('overflow'))
-                    .css('padding',  this.$elmt.css('padding'));
-
-                // Some browsers don't compute padding shorthand
-                if (!this.$elmt.css('padding')) {
-                    $wrapper
-                        .css('padding-top',    this.$elmt.css('padding-top'))
-                        .css('padding-bottom', this.$elmt.css('padding-bottom'))
-                        .css('padding-left',   this.$elmt.css('padding-left'))
-                        .css('padding-right',  this.$elmt.css('padding-right'));
-                }
-
-                this.$elmt.clone(true).children().appendTo($wrapper);
-                this.elmt.innerHTML = '';
-            }
+      // Container
+      this.$elmt.addClass('vegas-container');
 
-            // Timer
-            if (timer && this.support.transition) {
-                $timer = $('<div class="vegas-timer"><div class="vegas-timer-progress">');
-                this.$timer = $timer;
-                this.$elmt.prepend($timer);
-            }
-
-            // Overlay
-            if (overlay) {
-                $overlay = $('<div class="vegas-overlay">');
-
-                if (typeof overlay === 'string') {
-                    $overlay.css('background-image', 'url(' + overlay + ')');
-                }
-
-                this.$overlay = $overlay;
-                this.$elmt.prepend($overlay);
-            }
-
-            // Container
-            this.$elmt.addClass('vegas-container');
-
-            if (!isBody) {
-                this.$elmt.append($wrapper);
-            }
+      if (!isBody) {
+        this.$elmt.append($wrapper);
+      }
 
-            setTimeout(function () {
-                self.trigger('init');
-                self._goto(self.slide);
+      setTimeout(function () {
+        self.trigger('init');
+        self._goto(self.slide);
 
-                if (self.settings.autoplay) {
-                    self.trigger('play');
-                }
-            }, 1);
-        },
-
-        _preload: function () {
-            var img, i;
-
-            for (i = 0; i < this.settings.slides.length; i++) {
-                if (this.settings.preload || this.settings.preloadImages) {
-                    if (this.settings.slides[i].src) {
-                        img = new Image();
-                        img.src = this.settings.slides[i].src;
-                    }
-                }
-
-                if (this.settings.preload || this.settings.preloadVideos) {
-                    if (this.support.video && this.settings.slides[i].video) {
-                        if (this.settings.slides[i].video instanceof Array) {
-                            this._video(this.settings.slides[i].video);
-                        } else {
-                            this._video(this.settings.slides[i].video.src);
-                        }
-                    }
-                }
-            }
-        },
-
-        _random: function (array) {
-            return array[Math.floor(Math.random() * array.length)];
-        },
-
-        _slideShow: function () {
-            var self = this;
-
-            if (this.total > 1 && !this.ended && !this.paused && !this.noshow) {
-                this.timeout = setTimeout(function () {
-                    self.next();
-                }, this._options('delay'));
-            }
-        },
-
-        _timer: function (state) {
-            var self = this;
-
-            clearTimeout(this.timeout);
-
-            if (!this.$timer) {
-                return;
-            }
-
-            this.$timer
-                .removeClass('vegas-timer-running')
-                    .find('div')
-                        .css('transition-duration', '0ms');
-
-            if (this.ended || this.paused || this.noshow) {
-                return;
-            }
-
-            if (state) {
-                setTimeout(function () {
-                    self.$timer
-                    .addClass('vegas-timer-running')
-                        .find('div')
-                            .css('transition-duration', self._options('delay') - 100 + 'ms');
-                }, 100);
-            }
-        },
-
-        _video: function (srcs) {
-            var video,
-                source,
-                cacheKey = srcs.toString();
-
-            if (videoCache[cacheKey]) {
-                return videoCache[cacheKey];
-            }
-
-            if (srcs instanceof Array === false) {
-                srcs = [ srcs ];
-            }
-
-            video = document.createElement('video');
-            video.preload = true;
-
-            srcs.forEach(function (src) {
-                source = document.createElement('source');
-                source.src = src;
-                video.appendChild(source);
-            });
-
-            videoCache[cacheKey] = video;
-
-            return video;
-        },
-
-        _fadeOutSound: function (video, duration) {
-            var self   = this,
-                delay  = duration / 10,
-                volume = video.volume - 0.09;
-
-            if (volume > 0) {
-                video.volume = volume;
+        if (self.settings.autoplay) {
+          self.trigger('play');
+        }
+      }, 1);
+    },
+
+    _preload: function () {
+      var img, i;
+
+      for (i = 0; i < this.settings.slides.length; i++) {
+        if (this.settings.preload || this.settings.preloadImages) {
+          if (this.settings.slides[i].src) {
+            img = new Image();
+            img.src = this.settings.slides[i].src;
+          }
+        }
 
-                setTimeout(function () {
-                    self._fadeOutSound(video, duration);
-                }, delay);
+        if (this.settings.preload || this.settings.preloadVideos) {
+          if (this.support.video && this.settings.slides[i].video) {
+            if (this.settings.slides[i].video instanceof Array) {
+              this._video(this.settings.slides[i].video);
             } else {
-                video.pause();
-            }
-        },
-
-        _fadeInSound: function (video, duration) {
-            var self   = this,
-                delay  = duration / 10,
-                volume = video.volume + 0.09;
-
-            if (volume < 1) {
-                video.volume = volume;
-
-                setTimeout(function () {
-                    self._fadeInSound(video, duration);
-                }, delay);
-            }
-        },
-
-        _options: function (key, i) {
-            if (i === undefined) {
-                i = this.slide;
-            }
-
-            if (this.settings.slides[i][key] !== undefined) {
-                return this.settings.slides[i][key];
+              this._video(this.settings.slides[i].video.src);
             }
+          }
+        }
+      }
+    },
+
+    _random: function (array) {
+      return array[Math.floor(Math.random() * array.length)];
+    },
+
+    _slideShow: function () {
+      var self = this;
+
+      if (this.total > 1 && !this.ended && !this.paused && !this.noshow) {
+        this.timeout = setTimeout(function () {
+          self.next();
+        }, this._options('delay'));
+      }
+    },
+
+    _timer: function (state) {
+      var self = this;
+
+      clearTimeout(this.timeout);
+
+      if (!this.$timer) {
+        return;
+      }
+
+      this.$timer
+        .removeClass('vegas-timer-running')
+        .find('div')
+        .css('transition-duration', '0ms');
+
+      if (this.ended || this.paused || this.noshow) {
+        return;
+      }
+
+      if (state) {
+        setTimeout(function () {
+          self.$timer
+            .addClass('vegas-timer-running')
+            .find('div')
+            .css('transition-duration', self._options('delay') - 100 + 'ms');
+        }, 100);
+      }
+    },
+
+    _video: function (srcs) {
+      var video,
+        source,
+        cacheKey = srcs.toString();
+
+      if (videoCache[cacheKey]) {
+        return videoCache[cacheKey];
+      }
+
+      if (srcs instanceof Array === false) {
+        srcs = [ srcs ];
+      }
+
+      video = document.createElement('video');
+      video.preload = true;
+
+      srcs.forEach(function (src) {
+        source = document.createElement('source');
+        source.src = src;
+        video.appendChild(source);
+      });
+
+      videoCache[cacheKey] = video;
+
+      return video;
+    },
+
+    _fadeOutSound: function (video, duration) {
+      var self   = this,
+        delay  = duration / 10,
+        volume = video.volume - 0.09;
+
+      if (volume > 0) {
+        video.volume = volume;
+
+        setTimeout(function () {
+          self._fadeOutSound(video, duration);
+        }, delay);
+      } else {
+        video.pause();
+      }
+    },
+
+    _fadeInSound: function (video, duration) {
+      var self   = this,
+        delay  = duration / 10,
+        volume = video.volume + 0.09;
+
+      if (volume < 1) {
+        video.volume = volume;
+
+        setTimeout(function () {
+          self._fadeInSound(video, duration);
+        }, delay);
+      }
+    },
+
+    _options: function (key, i) {
+      if (i === undefined) {
+        i = this.slide;
+      }
+
+      if (this.settings.slides[i][key] !== undefined) {
+        return this.settings.slides[i][key];
+      }
+
+      return this.settings[key];
+    },
+
+    _goto: function (nb) {
+      if (typeof this.settings.slides[nb] === 'undefined') {
+        nb = 0;
+      }
+
+      this.slide = nb;
+
+      var $slide,
+        $inner,
+        $video,
+        $slides       = this.$elmt.children('.vegas-slide'),
+        src           = this.settings.slides[nb].src,
+        videoSettings = this.settings.slides[nb].video,
+        delay         = this._options('delay'),
+        align         = this._options('align'),
+        valign        = this._options('valign'),
+        cover         = this._options('cover'),
+        color         = this._options('color') || this.$elmt.css('background-color'),
+        self          = this,
+        total         = $slides.length,
+        video,
+        img;
+
+      var transition         = this._options('transition'),
+        transitionDuration = this._options('transitionDuration'),
+        animation          = this._options('animation'),
+        animationDuration  = this._options('animationDuration');
+
+      if (this.settings.firstTransition && this.first) {
+        transition = this.settings.firstTransition || transition;
+      }
+
+      if (this.settings.firstTransitionDuration && this.first) {
+        transitionDuration = this.settings.firstTransitionDuration || transitionDuration;
+      }
+
+      if (this.first) {
+        this.first = false;
+      }
+
+      if (cover !== 'repeat') {
+        if (cover === true) {
+          cover = 'cover';
+        } else if (cover === false) {
+          cover = 'contain';
+        }
+      }
 
-            return this.settings[key];
-        },
-
-        _goto: function (nb) {
-            if (typeof this.settings.slides[nb] === 'undefined') {
-                nb = 0;
-            }
+      if (transition === 'random' || transition instanceof Array) {
+        if (transition instanceof Array) {
+          transition = this._random(transition);
+        } else {
+          transition = this._random(this.transitions);
+        }
+      }
 
-            this.slide = nb;
-
-            var $slide,
-                $inner,
-                $video,
-                $slides       = this.$elmt.children('.vegas-slide'),
-                src           = this.settings.slides[nb].src,
-                videoSettings = this.settings.slides[nb].video,
-                delay         = this._options('delay'),
-                align         = this._options('align'),
-                valign        = this._options('valign'),
-                cover         = this._options('cover'),
-                color         = this._options('color') || this.$elmt.css('background-color'),
-                self          = this,
-                total         = $slides.length,
-                video,
-                img;
-
-            var transition         = this._options('transition'),
-                transitionDuration = this._options('transitionDuration'),
-                animation          = this._options('animation'),
-                animationDuration  = this._options('animationDuration');
-
-            if (this.settings.firstTransition && this.first) {
-                transition = this.settings.firstTransition || transition;
-            }
+      if (animation === 'random' || animation instanceof Array) {
+        if (animation instanceof Array) {
+          animation = this._random(animation);
+        } else {
+          animation = this._random(this.animations);
+        }
+      }
 
-            if (this.settings.firstTransitionDuration && this.first) {
-                transitionDuration = this.settings.firstTransitionDuration || transitionDuration;
-            }
+      if (transitionDuration === 'auto' || transitionDuration > delay) {
+        transitionDuration = delay;
+      }
 
-            if (this.first) {
-                this.first = false;
-            }
+      if (animationDuration === 'auto') {
+        animationDuration = delay;
+      }
 
-            if (cover !== 'repeat') {
-                if (cover === true) {
-                    cover = 'cover';
-                } else if (cover === false) {
-                    cover = 'contain';
-                }
-            }
+      $slide = $('<div class="vegas-slide"></div>');
 
-            if (transition === 'random' || transition instanceof Array) {
-                if (transition instanceof Array) {
-                    transition = this._random(transition);
-                } else {
-                    transition = this._random(this.transitions);
-                }
-            }
+      if (this.support.transition && transition) {
+        $slide.addClass('vegas-transition-' + transition);
+      }
 
-            if (animation === 'random' || animation instanceof Array) {
-                if (animation instanceof Array) {
-                    animation = this._random(animation);
-                } else {
-                    animation = this._random(this.animations);
-                }
-            }
+      // Video
 
-            if (transitionDuration === 'auto' || transitionDuration > delay) {
-                transitionDuration = delay;
-            }
-
-            if (animationDuration === 'auto') {
-                animationDuration = delay;
-            }
+      if (this.support.video && videoSettings) {
+        if (videoSettings instanceof Array) {
+          video = this._video(videoSettings);
+        } else {
+          video = this._video(videoSettings.src);
+        }
 
-            $slide = $('<div class="vegas-slide"></div>');
+        video.loop  = videoSettings.loop !== undefined ? videoSettings.loop : true;
+        video.muted = videoSettings.mute !== undefined ? videoSettings.mute : true;
 
-            if (this.support.transition && transition) {
-                $slide.addClass('vegas-transition-' + transition);
-            }
-
-            // Video
+        if (video.muted === false) {
+          video.volume = 0;
+          this._fadeInSound(video, transitionDuration);
+        } else {
+          video.pause();
+        }
 
-            if (this.support.video && videoSettings) {
-                if (videoSettings instanceof Array) {
-                    video = this._video(videoSettings);
-                } else {
-                    video = this._video(videoSettings.src);
-                }
+        $video = $(video)
+          .addClass('vegas-video')
+          .css('background-color', color);
+
+        if (this.support.objectFit) {
+          $video
+            .css('object-position', align + ' ' + valign)
+            .css('object-fit', cover)
+            .css('width',  '100%')
+            .css('height', '100%');
+        } else if (cover === 'contain') {
+          $video
+            .css('width',  '100%')
+            .css('height', '100%');
+        }
 
-                video.loop  = videoSettings.loop !== undefined ? videoSettings.loop : true;
-                video.muted = videoSettings.mute !== undefined ? videoSettings.mute : true;
+        $slide.append($video);
 
-                if (video.muted === false) {
-                    video.volume = 0;
-                    this._fadeInSound(video, transitionDuration);
-                } else {
-                    video.pause();
-                }
+        // Image
 
-                $video = $(video)
-                    .addClass('vegas-video')
-                    .css('background-color', color);
-
-                if (this.support.objectFit) {
-                    $video
-                        .css('object-position', align + ' ' + valign)
-                        .css('object-fit', cover)
-                        .css('width',  '100%')
-                        .css('height', '100%');
-                } else if (cover === 'contain') {
-                    $video
-                        .css('width',  '100%')
-                        .css('height', '100%');
-                }
+      } else {
+        img = new Image();
 
-                $slide.append($video);
+        $inner = $('<div class="vegas-slide-inner"></div>')
+          .css('background-image',    'url("' + src + '")')
+          .css('background-color',    color)
+          .css('background-position', align + ' ' + valign);
 
-            // Image
+        if (cover === 'repeat') {
+          $inner.css('background-repeat', 'repeat');
+        } else {
+          $inner.css('background-size', cover);
+        }
 
-            } else {
-                img = new Image();
+        if (this.support.transition && animation) {
+          $inner
+            .addClass('vegas-animation-' + animation)
+            .css('animation-duration',  animationDuration + 'ms');
+        }
 
-                $inner = $('<div class="vegas-slide-inner"></div>')
-                    .css('background-image',    'url("' + src + '")')
-                    .css('background-color',    color)
-                    .css('background-position', align + ' ' + valign);
+        $slide.append($inner);
+      }
 
-                if (cover === 'repeat') {
-                    $inner.css('background-repeat', 'repeat');
-                } else {
-                    $inner.css('background-size', cover);
-                }
+      if (!this.support.transition) {
+        $slide.css('display', 'none');
+      }
 
-                if (this.support.transition && animation) {
-                    $inner
-                        .addClass('vegas-animation-' + animation)
-                        .css('animation-duration',  animationDuration + 'ms');
-                }
+      if (total) {
+        $slides.eq(total - 1).after($slide);
+      } else {
+        this.$elmt.prepend($slide);
+      }
 
-                $slide.append($inner);
-            }
+      $slides
+        .css('transition', 'all 0ms')
+        .each(function () {
+          this.className  = 'vegas-slide';
 
-            if (!this.support.transition) {
-                $slide.css('display', 'none');
-            }
+          if (this.tagName === 'VIDEO') {
+            this.className += ' vegas-video';
+          }
 
-            if (total) {
-                $slides.eq(total - 1).after($slide);
-            } else {
-                this.$elmt.prepend($slide);
-            }
+          if (transition) {
+            this.className += ' vegas-transition-' + transition;
+            this.className += ' vegas-transition-' + transition + '-in';
+          }
+        }
+        );
 
-            $slides
-                .css('transition', 'all 0ms')
-                .each(function () {
-                    this.className  = 'vegas-slide';
+      self._timer(false);
 
-                    if (this.tagName === 'VIDEO') {
-                        this.className += ' vegas-video';
-                    }
+      function go () {
+        self._timer(true);
 
-                    if (transition) {
-                        this.className += ' vegas-transition-' + transition;
-                        this.className += ' vegas-transition-' + transition + '-in';
-                    }
-                }
-            );
-
-            self._timer(false);
-
-            function go () {
-                self._timer(true);
-
-                setTimeout(function () {
-                    if (transition) {
-                        if (self.support.transition) {
-                            $slides
-                                .css('transition', 'all ' + transitionDuration + 'ms')
-                                .addClass('vegas-transition-' + transition + '-out');
-
-                            $slides.each(function () {
-                                var video = $slides.find('video').get(0);
-
-                                if (video) {
-                                    video.volume = 1;
-                                    self._fadeOutSound(video, transitionDuration);
-                                }
-                            });
-
-                            $slide
-                                .css('transition', 'all ' + transitionDuration + 'ms')
-                                .addClass('vegas-transition-' + transition + '-in');
-                        } else {
-                            $slide.fadeIn(transitionDuration);
-                        }
-                    }
-
-                    for (var i = 0; i < $slides.length - self.settings.slidesToKeep; i++) {
-                        $slides.eq(i).remove();
-                    }
-
-                    self.trigger('walk');
-                    self._slideShow();
-                }, 100);
-            }
-            if (video) {
-                if (video.readyState === 4) {
-                    video.currentTime = 0;
-                }
+        setTimeout(function () {
+          if (transition) {
+            if (self.support.transition) {
+              $slides
+                .css('transition', 'all ' + transitionDuration + 'ms')
+                .addClass('vegas-transition-' + transition + '-out');
 
-                video.play();
-                go();
-            } else {
-                img.src = src;
+              $slides.each(function () {
+                var video = $slides.find('video').get(0);
 
-                if (img.complete) {
-                    go();
-                } else {
-                    img.onload = go;
+                if (video) {
+                  video.volume = 1;
+                  self._fadeOutSound(video, transitionDuration);
                 }
-            }
-        },
-
-        _end: function () {
-            if (this.settings.autoplay) {
-                this.ended = false;
-            } else {
-                this.ended = true;
-            }
-            this._timer(false);
-            this.trigger('end');
-        },
-
-        shuffle: function () {
-            var temp,
-                rand;
-
-            for (var i = this.total - 1; i > 0; i--) {
-                rand = Math.floor(Math.random() * (i + 1));
-                temp = this.settings.slides[i];
-
-                this.settings.slides[i] = this.settings.slides[rand];
-                this.settings.slides[rand] = temp;
-            }
-        },
-
-        play: function () {
-            if (this.paused) {
-                this.paused = false;
-                this.next();
-                this.trigger('play');
-            }
-        },
-
-        pause: function () {
-            this._timer(false);
-            this.paused = true;
-            this.trigger('pause');
-        },
+              });
 
-        toggle: function () {
-            if (this.paused) {
-                this.play();
+              $slide
+                .css('transition', 'all ' + transitionDuration + 'ms')
+                .addClass('vegas-transition-' + transition + '-in');
             } else {
-                this.pause();
-            }
-        },
-
-        playing: function () {
-            return !this.paused && !this.noshow;
-        },
-
-        current: function (advanced) {
-            if (advanced) {
-                return {
-                    slide: this.slide,
-                    data:  this.settings.slides[this.slide]
-                };
-            }
-            return this.slide;
-        },
-
-        jump: function (nb) {
-            if (nb < 0 || nb > this.total - 1 || nb === this.slide) {
-                return;
+              $slide.fadeIn(transitionDuration);
             }
+          }
 
-            this.slide = nb;
-            this._goto(this.slide);
-        },
+          for (var i = 0; i < $slides.length - self.settings.slidesToKeep; i++) {
+            $slides.eq(i).remove();
+          }
 
-        next: function () {
-            this.slide++;
-
-            if (this.slide >= this.total) {
-                if (!this.settings.loop) {
-                    return this._end();
-                }
+          self.trigger('walk');
+          self._slideShow();
+        }, 100);
+      }
+      if (video) {
+        if (video.readyState === 4) {
+          video.currentTime = 0;
+        }
 
-                this.slide = 0;
-            }
+        video.play();
+        go();
+      } else {
+        img.src = src;
 
-            this._goto(this.slide);
-        },
+        if (img.complete) {
+          go();
+        } else {
+          img.onload = go;
+        }
+      }
+    },
+
+    _end: function () {
+      if (this.settings.autoplay) {
+        this.ended = false;
+      } else {
+        this.ended = true;
+      }
+      this._timer(false);
+      this.trigger('end');
+    },
+
+    shuffle: function () {
+      var temp,
+        rand;
+
+      for (var i = this.total - 1; i > 0; i--) {
+        rand = Math.floor(Math.random() * (i + 1));
+        temp = this.settings.slides[i];
+
+        this.settings.slides[i] = this.settings.slides[rand];
+        this.settings.slides[rand] = temp;
+      }
+    },
+
+    play: function () {
+      if (this.paused) {
+        this.paused = false;
+        this.next();
+        this.trigger('play');
+      }
+    },
+
+    pause: function () {
+      this._timer(false);
+      this.paused = true;
+      this.trigger('pause');
+    },
+
+    toggle: function () {
+      if (this.paused) {
+        this.play();
+      } else {
+        this.pause();
+      }
+    },
+
+    playing: function () {
+      return !this.paused && !this.noshow;
+    },
+
+    current: function (advanced) {
+      if (advanced) {
+        return {
+          slide: this.slide,
+          data:  this.settings.slides[this.slide]
+        };
+      }
+      return this.slide;
+    },
 
-        previous: function () {
-            this.slide--;
+    jump: function (nb) {
+      if (nb < 0 || nb > this.total - 1 || nb === this.slide) {
+        return;
+      }
 
-            if (this.slide < 0) {
-                if (!this.settings.loop) {
-                    this.slide++;
-                    return;
-                } else {
-                    this.slide = this.total - 1;
-                }
-            }
+      this.slide = nb;
+      this._goto(this.slide);
+    },
 
-            this._goto(this.slide);
-        },
+    next: function () {
+      this.slide++;
 
-        trigger: function (fn) {
-            var params = [];
+      if (this.slide >= this.total) {
+        if (!this.settings.loop) {
+          return this._end();
+        }
 
-            if (fn === 'init') {
-                params = [ this.settings ];
-            } else {
-                params = [
-                    this.slide,
-                    this.settings.slides[this.slide]
-                ];
-            }
+        this.slide = 0;
+      }
 
-            this.$elmt.trigger('vegas' + fn, params);
+      this._goto(this.slide);
+    },
 
-            if (typeof this.settings[fn] === 'function') {
-                this.settings[fn].apply(this.$elmt, params);
-            }
-        },
+    previous: function () {
+      this.slide--;
 
-        options: function (key, value) {
-            var oldSlides = this.settings.slides.slice();
+      if (this.slide < 0) {
+        if (!this.settings.loop) {
+          this.slide++;
+          return;
+        } else {
+          this.slide = this.total - 1;
+        }
+      }
 
-            if (typeof key === 'object') {
-                this.settings = $.extend({}, defaults, $.vegas.defaults, key);
-            } else if (typeof key === 'string') {
-                if (value === undefined) {
-                    return this.settings[key];
-                }
-                this.settings[key] = value;
-            } else {
-                return this.settings;
-            }
+      this._goto(this.slide);
+    },
 
-            // In case slides have changed
-            if (this.settings.slides !== oldSlides) {
-                this.total  = this.settings.slides.length;
-                this.noshow = this.total < 2;
-                this._preload();
-            }
-        },
+    trigger: function (fn) {
+      var params = [];
 
-        destroy: function () {
-            clearTimeout(this.timeout);
+      if (fn === 'init') {
+        params = [ this.settings ];
+      } else {
+        params = [
+          this.slide,
+          this.settings.slides[this.slide]
+        ];
+      }
 
-            this.$elmt.removeClass('vegas-container');
-            this.$elmt.find('> .vegas-slide').remove();
-            this.$elmt.find('> .vegas-wrapper').clone(true).children().appendTo(this.$elmt);
-            this.$elmt.find('> .vegas-wrapper').remove();
+      this.$elmt.trigger('vegas' + fn, params);
 
-            if (this.settings.timer) {
-                this.$timer.remove();
-            }
+      if (typeof this.settings[fn] === 'function') {
+        this.settings[fn].apply(this.$elmt, params);
+      }
+    },
 
-            if (this.settings.overlay) {
-                this.$overlay.remove();
-            }
+    options: function (key, value) {
+      var oldSlides = this.settings.slides.slice();
 
-            this.elmt._vegas = null;
+      if (typeof key === 'object') {
+        this.settings = $.extend({}, defaults, $.vegas.defaults, key);
+      } else if (typeof key === 'string') {
+        if (value === undefined) {
+          return this.settings[key];
         }
-    };
-
-    $.fn.vegas = function(options) {
-        var args = arguments,
-            error = false,
-            returns;
-
-        if (options === undefined || typeof options === 'object') {
-            return this.each(function () {
-                if (!this._vegas) {
-                    this._vegas = new Vegas(this, options);
-                }
-            });
-        } else if (typeof options === 'string') {
-            this.each(function () {
-                var instance = this._vegas;
+        this.settings[key] = value;
+      } else {
+        return this.settings;
+      }
+
+      // In case slides have changed
+      if (this.settings.slides !== oldSlides) {
+        this.total  = this.settings.slides.length;
+        this.noshow = this.total < 2;
+        this._preload();
+      }
+    },
+
+    destroy: function () {
+      clearTimeout(this.timeout);
+
+      this.$elmt.removeClass('vegas-container');
+      this.$elmt.find('> .vegas-slide').remove();
+      this.$elmt.find('> .vegas-wrapper').clone(true).children().appendTo(this.$elmt);
+      this.$elmt.find('> .vegas-wrapper').remove();
+
+      if (this.settings.timer) {
+        this.$timer.remove();
+      }
+
+      if (this.settings.overlay) {
+        this.$overlay.remove();
+      }
+
+      this.elmt._vegas = null;
+    }
+  };
+
+  $.fn.vegas = function(options) {
+    var args = arguments,
+      error = false,
+      returns;
+
+    if (options === undefined || typeof options === 'object') {
+      return this.each(function () {
+        if (!this._vegas) {
+          this._vegas = new Vegas(this, options);
+        }
+      });
+    } else if (typeof options === 'string') {
+      this.each(function () {
+        var instance = this._vegas;
 
-                if (!instance) {
-                    throw new Error('No Vegas applied to this element.');
-                }
+        if (!instance) {
+          throw new Error('No Vegas applied to this element.');
+        }
 
-                if (typeof instance[options] === 'function' && options[0] !== '_') {
-                    returns = instance[options].apply(instance, [].slice.call(args, 1));
-                } else {
-                    error = true;
-                }
-            });
+        if (typeof instance[options] === 'function' && options[0] !== '_') {
+          returns = instance[options].apply(instance, [].slice.call(args, 1));
+        } else {
+          error = true;
+        }
+      });
 
-            if (error) {
-                throw new Error('No method "' + options + '" in Vegas.');
-            }
+      if (error) {
+        throw new Error('No method "' + options + '" in Vegas.');
+      }
 
-            return returns !== undefined ? returns : this;
-        }
-    };
+      return returns !== undefined ? returns : this;
+    }
+  };
 
-    $.vegas = {};
-    $.vegas.defaults = defaults;
+  $.vegas = {};
+  $.vegas.defaults = defaults;
 
-    $.vegas.isVideoCompatible = function () {
-        return !/(Android|webOS|Phone|iPad|iPod|BlackBerry|Windows Phone)/i.test(navigator.userAgent);
-    };
+  $.vegas.isVideoCompatible = function () {
+    return !/(Android|webOS|Phone|iPad|iPod|BlackBerry|Windows Phone)/i.test(navigator.userAgent);
+  };
 
 })(window.jQuery || window.Zepto);

Файловите разлики са ограничени, защото са твърде много
+ 0 - 0
dist/vegas.min.css


Файловите разлики са ограничени, защото са твърде много
+ 0 - 0
dist/vegas.min.css.map


Файловите разлики са ограничени, защото са твърде много
+ 2 - 2
dist/vegas.min.js


Файловите разлики са ограничени, защото са твърде много
+ 0 - 0
dist/vegas.min.js.map


+ 1 - 1
gulpfile.js

@@ -185,7 +185,7 @@
             .pipe(plugins.sourcemaps.init())
             .pipe(plugins.uglify({
                 compress: {
-                    warnings: false
+
                 },
                 mangle: true,
                 output: {

+ 662 - 664
src/vegas.js

@@ -1,742 +1,740 @@
 
 (function ($) {
-    'use strict';
-
-    var defaults = {
-        slide:                   0,
-        delay:                   5000,
-        loop:                    true,
-        preload:                 false,
-        preloadImage:            false,
-        preloadVideo:            false,
-        timer:                   true,
-        overlay:                 false,
-        autoplay:                true,
-        shuffle:                 false,
-        cover:                   true,
-        color:                   null,
-        align:                   'center',
-        valign:                  'center',
-        firstTransition:         null,
-        firstTransitionDuration: null,
-        transition:              'fade',
-        transitionDuration:      1000,
-        transitionRegister:      [],
-        animation:               null,
-        animationDuration:       'auto',
-        animationRegister:       [],
-        slidesToKeep:            1,
-        init:  function () {},
-        play:  function () {},
-        pause: function () {},
-        walk:  function () {},
-        slides: [
-            // {
-            //  src:                null,
-            //  color:              null,
-            //  delay:              null,
-            //  align:              null,
-            //  valign:             null,
-            //  transition:         null,
-            //  transitionDuration: null,
-            //  animation:          null,
-            //  animationDuration:  null,
-            //  cover:              true,
-            //  video: {
-            //      src: [],
-            //      mute: true,
-            //      loop: true
-            // }
-            // ...
-        ]
+  'use strict';
+
+  var defaults = {
+    slide:                   0,
+    delay:                   5000,
+    loop:                    true,
+    preload:                 false,
+    preloadImage:            false,
+    preloadVideo:            false,
+    timer:                   true,
+    overlay:                 false,
+    autoplay:                true,
+    shuffle:                 false,
+    cover:                   true,
+    color:                   null,
+    align:                   'center',
+    valign:                  'center',
+    firstTransition:         null,
+    firstTransitionDuration: null,
+    transition:              'fade',
+    transitionDuration:      1000,
+    transitionRegister:      [],
+    animation:               null,
+    animationDuration:       'auto',
+    animationRegister:       [],
+    slidesToKeep:            1,
+    init:  function () {},
+    play:  function () {},
+    pause: function () {},
+    walk:  function () {},
+    slides: [
+      // {
+      //  src:                null,
+      //  color:              null,
+      //  delay:              null,
+      //  align:              null,
+      //  valign:             null,
+      //  transition:         null,
+      //  transitionDuration: null,
+      //  animation:          null,
+      //  animationDuration:  null,
+      //  cover:              true,
+      //  video: {
+      //      src: [],
+      //      mute: true,
+      //      loop: true
+      // }
+      // ...
+    ]
+  };
+
+  var videoCache = {};
+
+  var Vegas = function (elmt, options) {
+    this.elmt         = elmt;
+    this.settings     = $.extend({}, defaults, $.vegas.defaults, options);
+    this.slide        = this.settings.slide;
+    this.total        = this.settings.slides.length;
+    this.noshow       = this.total < 2;
+    this.paused       = !this.settings.autoplay || this.noshow;
+    this.ended        = false;
+    this.$elmt        = $(elmt);
+    this.$timer       = null;
+    this.$overlay     = null;
+    this.$slide       = null;
+    this.timeout      = null;
+    this.first        = true;
+
+    this.transitions = [
+      'fade', 'fade2',
+      'blur', 'blur2',
+      'flash', 'flash2',
+      'negative', 'negative2',
+      'burn', 'burn2',
+      'slideLeft', 'slideLeft2',
+      'slideRight', 'slideRight2',
+      'slideUp', 'slideUp2',
+      'slideDown', 'slideDown2',
+      'zoomIn', 'zoomIn2',
+      'zoomOut', 'zoomOut2',
+      'swirlLeft', 'swirlLeft2',
+      'swirlRight', 'swirlRight2'
+    ];
+
+    this.animations = [
+      'kenburns',
+      'kenburnsLeft', 'kenburnsRight',
+      'kenburnsUp', 'kenburnsUpLeft', 'kenburnsUpRight',
+      'kenburnsDown', 'kenburnsDownLeft', 'kenburnsDownRight'
+    ];
+
+    if (this.settings.transitionRegister instanceof Array === false) {
+      this.settings.transitionRegister = [ this.settings.transitionRegister ];
+    }
+
+    if (this.settings.animationRegister instanceof Array === false) {
+      this.settings.animationRegister = [ this.settings.animationRegister ];
+    }
+
+    this.transitions = this.transitions.concat(this.settings.transitionRegister);
+    this.animations  = this.animations.concat(this.settings.animationRegister);
+
+    this.support = {
+      objectFit:  'objectFit'  in document.body.style,
+      transition: 'transition' in document.body.style || 'WebkitTransition' in document.body.style,
+      video:      $.vegas.isVideoCompatible()
     };
 
-    var videoCache = {};
-
-    var Vegas = function (elmt, options) {
-        this.elmt         = elmt;
-        this.settings     = $.extend({}, defaults, $.vegas.defaults, options);
-        this.slide        = this.settings.slide;
-        this.total        = this.settings.slides.length;
-        this.noshow       = this.total < 2;
-        this.paused       = !this.settings.autoplay || this.noshow;
-        this.ended        = false;
-        this.$elmt        = $(elmt);
-        this.$timer       = null;
-        this.$overlay     = null;
-        this.$slide       = null;
-        this.timeout      = null;
-        this.first        = true;
-
-        this.transitions = [
-            'fade', 'fade2',
-            'blur', 'blur2',
-            'flash', 'flash2',
-            'negative', 'negative2',
-            'burn', 'burn2',
-            'slideLeft', 'slideLeft2',
-            'slideRight', 'slideRight2',
-            'slideUp', 'slideUp2',
-            'slideDown', 'slideDown2',
-            'zoomIn', 'zoomIn2',
-            'zoomOut', 'zoomOut2',
-            'swirlLeft', 'swirlLeft2',
-            'swirlRight', 'swirlRight2'
-        ];
-
-        this.animations = [
-            'kenburns',
-            'kenburnsLeft', 'kenburnsRight',
-            'kenburnsUp', 'kenburnsUpLeft', 'kenburnsUpRight',
-            'kenburnsDown', 'kenburnsDownLeft', 'kenburnsDownRight'
-        ];
-
-        if (this.settings.transitionRegister instanceof Array === false) {
-            this.settings.transitionRegister = [ this.settings.transitionRegister ];
+    if (this.settings.shuffle === true) {
+      this.shuffle();
+    }
+
+    this._init();
+  };
+
+  Vegas.prototype = {
+    _init: function () {
+      var $wrapper,
+        $overlay,
+        $timer,
+        isBody  = this.elmt.tagName === 'BODY',
+        timer   = this.settings.timer,
+        overlay = this.settings.overlay,
+        self    = this;
+
+      // Preloading
+      this._preload();
+
+      // Wrapper with content
+      if (!isBody) {
+        $wrapper = $('<div class="vegas-wrapper">')
+          .css('overflow', this.$elmt.css('overflow'))
+          .css('padding',  this.$elmt.css('padding'));
+
+        // Some browsers don't compute padding shorthand
+        if (!this.$elmt.css('padding')) {
+          $wrapper
+            .css('padding-top',    this.$elmt.css('padding-top'))
+            .css('padding-bottom', this.$elmt.css('padding-bottom'))
+            .css('padding-left',   this.$elmt.css('padding-left'))
+            .css('padding-right',  this.$elmt.css('padding-right'));
         }
 
-        if (this.settings.animationRegister instanceof Array === false) {
-            this.settings.animationRegister = [ this.settings.animationRegister ];
-        }
+        this.$elmt.clone(true).children().appendTo($wrapper);
+        this.elmt.innerHTML = '';
+      }
 
-        this.transitions = this.transitions.concat(this.settings.transitionRegister);
-        this.animations  = this.animations.concat(this.settings.animationRegister);
+      // Timer
+      if (timer && this.support.transition) {
+        $timer = $('<div class="vegas-timer"><div class="vegas-timer-progress">');
+        this.$timer = $timer;
+        this.$elmt.prepend($timer);
+      }
 
-        this.support = {
-            objectFit:  'objectFit'  in document.body.style,
-            transition: 'transition' in document.body.style || 'WebkitTransition' in document.body.style,
-            video:      $.vegas.isVideoCompatible()
-        };
+      // Overlay
+      if (overlay) {
+        $overlay = $('<div class="vegas-overlay">');
 
-        if (this.settings.shuffle === true) {
-            this.shuffle();
+        if (typeof overlay === 'string') {
+          $overlay.css('background-image', 'url(' + overlay + ')');
         }
 
-        this._init();
-    };
+        this.$overlay = $overlay;
+        this.$elmt.prepend($overlay);
+      }
 
-    Vegas.prototype = {
-        _init: function () {
-            var $wrapper,
-                $overlay,
-                $timer,
-                isBody  = this.elmt.tagName === 'BODY',
-                timer   = this.settings.timer,
-                overlay = this.settings.overlay,
-                self    = this;
-
-            // Preloading
-            this._preload();
-
-            // Wrapper with content
-            if (!isBody) {
-                this.$elmt.css('height', this.$elmt.css('height'));
-
-                $wrapper = $('<div class="vegas-wrapper">')
-                    .css('overflow', this.$elmt.css('overflow'))
-                    .css('padding',  this.$elmt.css('padding'));
-
-                // Some browsers don't compute padding shorthand
-                if (!this.$elmt.css('padding')) {
-                    $wrapper
-                        .css('padding-top',    this.$elmt.css('padding-top'))
-                        .css('padding-bottom', this.$elmt.css('padding-bottom'))
-                        .css('padding-left',   this.$elmt.css('padding-left'))
-                        .css('padding-right',  this.$elmt.css('padding-right'));
-                }
-
-                this.$elmt.clone(true).children().appendTo($wrapper);
-                this.elmt.innerHTML = '';
-            }
+      // Container
+      this.$elmt.addClass('vegas-container');
 
-            // Timer
-            if (timer && this.support.transition) {
-                $timer = $('<div class="vegas-timer"><div class="vegas-timer-progress">');
-                this.$timer = $timer;
-                this.$elmt.prepend($timer);
-            }
-
-            // Overlay
-            if (overlay) {
-                $overlay = $('<div class="vegas-overlay">');
-
-                if (typeof overlay === 'string') {
-                    $overlay.css('background-image', 'url(' + overlay + ')');
-                }
-
-                this.$overlay = $overlay;
-                this.$elmt.prepend($overlay);
-            }
-
-            // Container
-            this.$elmt.addClass('vegas-container');
-
-            if (!isBody) {
-                this.$elmt.append($wrapper);
-            }
+      if (!isBody) {
+        this.$elmt.append($wrapper);
+      }
 
-            setTimeout(function () {
-                self.trigger('init');
-                self._goto(self.slide);
+      setTimeout(function () {
+        self.trigger('init');
+        self._goto(self.slide);
 
-                if (self.settings.autoplay) {
-                    self.trigger('play');
-                }
-            }, 1);
-        },
-
-        _preload: function () {
-            var img, i;
-
-            for (i = 0; i < this.settings.slides.length; i++) {
-                if (this.settings.preload || this.settings.preloadImages) {
-                    if (this.settings.slides[i].src) {
-                        img = new Image();
-                        img.src = this.settings.slides[i].src;
-                    }
-                }
-
-                if (this.settings.preload || this.settings.preloadVideos) {
-                    if (this.support.video && this.settings.slides[i].video) {
-                        if (this.settings.slides[i].video instanceof Array) {
-                            this._video(this.settings.slides[i].video);
-                        } else {
-                            this._video(this.settings.slides[i].video.src);
-                        }
-                    }
-                }
-            }
-        },
-
-        _random: function (array) {
-            return array[Math.floor(Math.random() * array.length)];
-        },
-
-        _slideShow: function () {
-            var self = this;
-
-            if (this.total > 1 && !this.ended && !this.paused && !this.noshow) {
-                this.timeout = setTimeout(function () {
-                    self.next();
-                }, this._options('delay'));
-            }
-        },
-
-        _timer: function (state) {
-            var self = this;
-
-            clearTimeout(this.timeout);
-
-            if (!this.$timer) {
-                return;
-            }
-
-            this.$timer
-                .removeClass('vegas-timer-running')
-                    .find('div')
-                        .css('transition-duration', '0ms');
-
-            if (this.ended || this.paused || this.noshow) {
-                return;
-            }
-
-            if (state) {
-                setTimeout(function () {
-                    self.$timer
-                    .addClass('vegas-timer-running')
-                        .find('div')
-                            .css('transition-duration', self._options('delay') - 100 + 'ms');
-                }, 100);
-            }
-        },
-
-        _video: function (srcs) {
-            var video,
-                source,
-                cacheKey = srcs.toString();
-
-            if (videoCache[cacheKey]) {
-                return videoCache[cacheKey];
-            }
-
-            if (srcs instanceof Array === false) {
-                srcs = [ srcs ];
-            }
-
-            video = document.createElement('video');
-            video.preload = true;
-
-            srcs.forEach(function (src) {
-                source = document.createElement('source');
-                source.src = src;
-                video.appendChild(source);
-            });
-
-            videoCache[cacheKey] = video;
-
-            return video;
-        },
-
-        _fadeOutSound: function (video, duration) {
-            var self   = this,
-                delay  = duration / 10,
-                volume = video.volume - 0.09;
-
-            if (volume > 0) {
-                video.volume = volume;
+        if (self.settings.autoplay) {
+          self.trigger('play');
+        }
+      }, 1);
+    },
+
+    _preload: function () {
+      var img, i;
+
+      for (i = 0; i < this.settings.slides.length; i++) {
+        if (this.settings.preload || this.settings.preloadImages) {
+          if (this.settings.slides[i].src) {
+            img = new Image();
+            img.src = this.settings.slides[i].src;
+          }
+        }
 
-                setTimeout(function () {
-                    self._fadeOutSound(video, duration);
-                }, delay);
+        if (this.settings.preload || this.settings.preloadVideos) {
+          if (this.support.video && this.settings.slides[i].video) {
+            if (this.settings.slides[i].video instanceof Array) {
+              this._video(this.settings.slides[i].video);
             } else {
-                video.pause();
-            }
-        },
-
-        _fadeInSound: function (video, duration) {
-            var self   = this,
-                delay  = duration / 10,
-                volume = video.volume + 0.09;
-
-            if (volume < 1) {
-                video.volume = volume;
-
-                setTimeout(function () {
-                    self._fadeInSound(video, duration);
-                }, delay);
-            }
-        },
-
-        _options: function (key, i) {
-            if (i === undefined) {
-                i = this.slide;
-            }
-
-            if (this.settings.slides[i][key] !== undefined) {
-                return this.settings.slides[i][key];
+              this._video(this.settings.slides[i].video.src);
             }
+          }
+        }
+      }
+    },
+
+    _random: function (array) {
+      return array[Math.floor(Math.random() * array.length)];
+    },
+
+    _slideShow: function () {
+      var self = this;
+
+      if (this.total > 1 && !this.ended && !this.paused && !this.noshow) {
+        this.timeout = setTimeout(function () {
+          self.next();
+        }, this._options('delay'));
+      }
+    },
+
+    _timer: function (state) {
+      var self = this;
+
+      clearTimeout(this.timeout);
+
+      if (!this.$timer) {
+        return;
+      }
+
+      this.$timer
+        .removeClass('vegas-timer-running')
+        .find('div')
+        .css('transition-duration', '0ms');
+
+      if (this.ended || this.paused || this.noshow) {
+        return;
+      }
+
+      if (state) {
+        setTimeout(function () {
+          self.$timer
+            .addClass('vegas-timer-running')
+            .find('div')
+            .css('transition-duration', self._options('delay') - 100 + 'ms');
+        }, 100);
+      }
+    },
+
+    _video: function (srcs) {
+      var video,
+        source,
+        cacheKey = srcs.toString();
+
+      if (videoCache[cacheKey]) {
+        return videoCache[cacheKey];
+      }
+
+      if (srcs instanceof Array === false) {
+        srcs = [ srcs ];
+      }
+
+      video = document.createElement('video');
+      video.preload = true;
+
+      srcs.forEach(function (src) {
+        source = document.createElement('source');
+        source.src = src;
+        video.appendChild(source);
+      });
+
+      videoCache[cacheKey] = video;
+
+      return video;
+    },
+
+    _fadeOutSound: function (video, duration) {
+      var self   = this,
+        delay  = duration / 10,
+        volume = video.volume - 0.09;
+
+      if (volume > 0) {
+        video.volume = volume;
+
+        setTimeout(function () {
+          self._fadeOutSound(video, duration);
+        }, delay);
+      } else {
+        video.pause();
+      }
+    },
+
+    _fadeInSound: function (video, duration) {
+      var self   = this,
+        delay  = duration / 10,
+        volume = video.volume + 0.09;
+
+      if (volume < 1) {
+        video.volume = volume;
+
+        setTimeout(function () {
+          self._fadeInSound(video, duration);
+        }, delay);
+      }
+    },
+
+    _options: function (key, i) {
+      if (i === undefined) {
+        i = this.slide;
+      }
+
+      if (this.settings.slides[i][key] !== undefined) {
+        return this.settings.slides[i][key];
+      }
+
+      return this.settings[key];
+    },
+
+    _goto: function (nb) {
+      if (typeof this.settings.slides[nb] === 'undefined') {
+        nb = 0;
+      }
+
+      this.slide = nb;
+
+      var $slide,
+        $inner,
+        $video,
+        $slides       = this.$elmt.children('.vegas-slide'),
+        src           = this.settings.slides[nb].src,
+        videoSettings = this.settings.slides[nb].video,
+        delay         = this._options('delay'),
+        align         = this._options('align'),
+        valign        = this._options('valign'),
+        cover         = this._options('cover'),
+        color         = this._options('color') || this.$elmt.css('background-color'),
+        self          = this,
+        total         = $slides.length,
+        video,
+        img;
+
+      var transition         = this._options('transition'),
+        transitionDuration = this._options('transitionDuration'),
+        animation          = this._options('animation'),
+        animationDuration  = this._options('animationDuration');
+
+      if (this.settings.firstTransition && this.first) {
+        transition = this.settings.firstTransition || transition;
+      }
+
+      if (this.settings.firstTransitionDuration && this.first) {
+        transitionDuration = this.settings.firstTransitionDuration || transitionDuration;
+      }
+
+      if (this.first) {
+        this.first = false;
+      }
+
+      if (cover !== 'repeat') {
+        if (cover === true) {
+          cover = 'cover';
+        } else if (cover === false) {
+          cover = 'contain';
+        }
+      }
 
-            return this.settings[key];
-        },
-
-        _goto: function (nb) {
-            if (typeof this.settings.slides[nb] === 'undefined') {
-                nb = 0;
-            }
+      if (transition === 'random' || transition instanceof Array) {
+        if (transition instanceof Array) {
+          transition = this._random(transition);
+        } else {
+          transition = this._random(this.transitions);
+        }
+      }
 
-            this.slide = nb;
-
-            var $slide,
-                $inner,
-                $video,
-                $slides       = this.$elmt.children('.vegas-slide'),
-                src           = this.settings.slides[nb].src,
-                videoSettings = this.settings.slides[nb].video,
-                delay         = this._options('delay'),
-                align         = this._options('align'),
-                valign        = this._options('valign'),
-                cover         = this._options('cover'),
-                color         = this._options('color') || this.$elmt.css('background-color'),
-                self          = this,
-                total         = $slides.length,
-                video,
-                img;
-
-            var transition         = this._options('transition'),
-                transitionDuration = this._options('transitionDuration'),
-                animation          = this._options('animation'),
-                animationDuration  = this._options('animationDuration');
-
-            if (this.settings.firstTransition && this.first) {
-                transition = this.settings.firstTransition || transition;
-            }
+      if (animation === 'random' || animation instanceof Array) {
+        if (animation instanceof Array) {
+          animation = this._random(animation);
+        } else {
+          animation = this._random(this.animations);
+        }
+      }
 
-            if (this.settings.firstTransitionDuration && this.first) {
-                transitionDuration = this.settings.firstTransitionDuration || transitionDuration;
-            }
+      if (transitionDuration === 'auto' || transitionDuration > delay) {
+        transitionDuration = delay;
+      }
 
-            if (this.first) {
-                this.first = false;
-            }
+      if (animationDuration === 'auto') {
+        animationDuration = delay;
+      }
 
-            if (cover !== 'repeat') {
-                if (cover === true) {
-                    cover = 'cover';
-                } else if (cover === false) {
-                    cover = 'contain';
-                }
-            }
+      $slide = $('<div class="vegas-slide"></div>');
 
-            if (transition === 'random' || transition instanceof Array) {
-                if (transition instanceof Array) {
-                    transition = this._random(transition);
-                } else {
-                    transition = this._random(this.transitions);
-                }
-            }
+      if (this.support.transition && transition) {
+        $slide.addClass('vegas-transition-' + transition);
+      }
 
-            if (animation === 'random' || animation instanceof Array) {
-                if (animation instanceof Array) {
-                    animation = this._random(animation);
-                } else {
-                    animation = this._random(this.animations);
-                }
-            }
+      // Video
 
-            if (transitionDuration === 'auto' || transitionDuration > delay) {
-                transitionDuration = delay;
-            }
-
-            if (animationDuration === 'auto') {
-                animationDuration = delay;
-            }
+      if (this.support.video && videoSettings) {
+        if (videoSettings instanceof Array) {
+          video = this._video(videoSettings);
+        } else {
+          video = this._video(videoSettings.src);
+        }
 
-            $slide = $('<div class="vegas-slide"></div>');
+        video.loop  = videoSettings.loop !== undefined ? videoSettings.loop : true;
+        video.muted = videoSettings.mute !== undefined ? videoSettings.mute : true;
 
-            if (this.support.transition && transition) {
-                $slide.addClass('vegas-transition-' + transition);
-            }
-
-            // Video
+        if (video.muted === false) {
+          video.volume = 0;
+          this._fadeInSound(video, transitionDuration);
+        } else {
+          video.pause();
+        }
 
-            if (this.support.video && videoSettings) {
-                if (videoSettings instanceof Array) {
-                    video = this._video(videoSettings);
-                } else {
-                    video = this._video(videoSettings.src);
-                }
+        $video = $(video)
+          .addClass('vegas-video')
+          .css('background-color', color);
+
+        if (this.support.objectFit) {
+          $video
+            .css('object-position', align + ' ' + valign)
+            .css('object-fit', cover)
+            .css('width',  '100%')
+            .css('height', '100%');
+        } else if (cover === 'contain') {
+          $video
+            .css('width',  '100%')
+            .css('height', '100%');
+        }
 
-                video.loop  = videoSettings.loop !== undefined ? videoSettings.loop : true;
-                video.muted = videoSettings.mute !== undefined ? videoSettings.mute : true;
+        $slide.append($video);
 
-                if (video.muted === false) {
-                    video.volume = 0;
-                    this._fadeInSound(video, transitionDuration);
-                } else {
-                    video.pause();
-                }
+        // Image
 
-                $video = $(video)
-                    .addClass('vegas-video')
-                    .css('background-color', color);
-
-                if (this.support.objectFit) {
-                    $video
-                        .css('object-position', align + ' ' + valign)
-                        .css('object-fit', cover)
-                        .css('width',  '100%')
-                        .css('height', '100%');
-                } else if (cover === 'contain') {
-                    $video
-                        .css('width',  '100%')
-                        .css('height', '100%');
-                }
+      } else {
+        img = new Image();
 
-                $slide.append($video);
+        $inner = $('<div class="vegas-slide-inner"></div>')
+          .css('background-image',    'url("' + src + '")')
+          .css('background-color',    color)
+          .css('background-position', align + ' ' + valign);
 
-            // Image
+        if (cover === 'repeat') {
+          $inner.css('background-repeat', 'repeat');
+        } else {
+          $inner.css('background-size', cover);
+        }
 
-            } else {
-                img = new Image();
+        if (this.support.transition && animation) {
+          $inner
+            .addClass('vegas-animation-' + animation)
+            .css('animation-duration',  animationDuration + 'ms');
+        }
 
-                $inner = $('<div class="vegas-slide-inner"></div>')
-                    .css('background-image',    'url("' + src + '")')
-                    .css('background-color',    color)
-                    .css('background-position', align + ' ' + valign);
+        $slide.append($inner);
+      }
 
-                if (cover === 'repeat') {
-                    $inner.css('background-repeat', 'repeat');
-                } else {
-                    $inner.css('background-size', cover);
-                }
+      if (!this.support.transition) {
+        $slide.css('display', 'none');
+      }
 
-                if (this.support.transition && animation) {
-                    $inner
-                        .addClass('vegas-animation-' + animation)
-                        .css('animation-duration',  animationDuration + 'ms');
-                }
+      if (total) {
+        $slides.eq(total - 1).after($slide);
+      } else {
+        this.$elmt.prepend($slide);
+      }
 
-                $slide.append($inner);
-            }
+      $slides
+        .css('transition', 'all 0ms')
+        .each(function () {
+          this.className  = 'vegas-slide';
 
-            if (!this.support.transition) {
-                $slide.css('display', 'none');
-            }
+          if (this.tagName === 'VIDEO') {
+            this.className += ' vegas-video';
+          }
 
-            if (total) {
-                $slides.eq(total - 1).after($slide);
-            } else {
-                this.$elmt.prepend($slide);
-            }
+          if (transition) {
+            this.className += ' vegas-transition-' + transition;
+            this.className += ' vegas-transition-' + transition + '-in';
+          }
+        }
+        );
 
-            $slides
-                .css('transition', 'all 0ms')
-                .each(function () {
-                    this.className  = 'vegas-slide';
+      self._timer(false);
 
-                    if (this.tagName === 'VIDEO') {
-                        this.className += ' vegas-video';
-                    }
+      function go () {
+        self._timer(true);
 
-                    if (transition) {
-                        this.className += ' vegas-transition-' + transition;
-                        this.className += ' vegas-transition-' + transition + '-in';
-                    }
-                }
-            );
-
-            self._timer(false);
-
-            function go () {
-                self._timer(true);
-
-                setTimeout(function () {
-                    if (transition) {
-                        if (self.support.transition) {
-                            $slides
-                                .css('transition', 'all ' + transitionDuration + 'ms')
-                                .addClass('vegas-transition-' + transition + '-out');
-
-                            $slides.each(function () {
-                                var video = $slides.find('video').get(0);
-
-                                if (video) {
-                                    video.volume = 1;
-                                    self._fadeOutSound(video, transitionDuration);
-                                }
-                            });
-
-                            $slide
-                                .css('transition', 'all ' + transitionDuration + 'ms')
-                                .addClass('vegas-transition-' + transition + '-in');
-                        } else {
-                            $slide.fadeIn(transitionDuration);
-                        }
-                    }
-
-                    for (var i = 0; i < $slides.length - self.settings.slidesToKeep; i++) {
-                        $slides.eq(i).remove();
-                    }
-
-                    self.trigger('walk');
-                    self._slideShow();
-                }, 100);
-            }
-            if (video) {
-                if (video.readyState === 4) {
-                    video.currentTime = 0;
-                }
+        setTimeout(function () {
+          if (transition) {
+            if (self.support.transition) {
+              $slides
+                .css('transition', 'all ' + transitionDuration + 'ms')
+                .addClass('vegas-transition-' + transition + '-out');
 
-                video.play();
-                go();
-            } else {
-                img.src = src;
+              $slides.each(function () {
+                var video = $slides.find('video').get(0);
 
-                if (img.complete) {
-                    go();
-                } else {
-                    img.onload = go;
+                if (video) {
+                  video.volume = 1;
+                  self._fadeOutSound(video, transitionDuration);
                 }
-            }
-        },
-
-        _end: function () {
-            if (this.settings.autoplay) {
-                this.ended = false;
-            } else {
-                this.ended = true;
-            }
-            this._timer(false);
-            this.trigger('end');
-        },
-
-        shuffle: function () {
-            var temp,
-                rand;
-
-            for (var i = this.total - 1; i > 0; i--) {
-                rand = Math.floor(Math.random() * (i + 1));
-                temp = this.settings.slides[i];
-
-                this.settings.slides[i] = this.settings.slides[rand];
-                this.settings.slides[rand] = temp;
-            }
-        },
-
-        play: function () {
-            if (this.paused) {
-                this.paused = false;
-                this.next();
-                this.trigger('play');
-            }
-        },
-
-        pause: function () {
-            this._timer(false);
-            this.paused = true;
-            this.trigger('pause');
-        },
+              });
 
-        toggle: function () {
-            if (this.paused) {
-                this.play();
+              $slide
+                .css('transition', 'all ' + transitionDuration + 'ms')
+                .addClass('vegas-transition-' + transition + '-in');
             } else {
-                this.pause();
-            }
-        },
-
-        playing: function () {
-            return !this.paused && !this.noshow;
-        },
-
-        current: function (advanced) {
-            if (advanced) {
-                return {
-                    slide: this.slide,
-                    data:  this.settings.slides[this.slide]
-                };
-            }
-            return this.slide;
-        },
-
-        jump: function (nb) {
-            if (nb < 0 || nb > this.total - 1 || nb === this.slide) {
-                return;
+              $slide.fadeIn(transitionDuration);
             }
+          }
 
-            this.slide = nb;
-            this._goto(this.slide);
-        },
+          for (var i = 0; i < $slides.length - self.settings.slidesToKeep; i++) {
+            $slides.eq(i).remove();
+          }
 
-        next: function () {
-            this.slide++;
-
-            if (this.slide >= this.total) {
-                if (!this.settings.loop) {
-                    return this._end();
-                }
+          self.trigger('walk');
+          self._slideShow();
+        }, 100);
+      }
+      if (video) {
+        if (video.readyState === 4) {
+          video.currentTime = 0;
+        }
 
-                this.slide = 0;
-            }
+        video.play();
+        go();
+      } else {
+        img.src = src;
 
-            this._goto(this.slide);
-        },
+        if (img.complete) {
+          go();
+        } else {
+          img.onload = go;
+        }
+      }
+    },
+
+    _end: function () {
+      if (this.settings.autoplay) {
+        this.ended = false;
+      } else {
+        this.ended = true;
+      }
+      this._timer(false);
+      this.trigger('end');
+    },
+
+    shuffle: function () {
+      var temp,
+        rand;
+
+      for (var i = this.total - 1; i > 0; i--) {
+        rand = Math.floor(Math.random() * (i + 1));
+        temp = this.settings.slides[i];
+
+        this.settings.slides[i] = this.settings.slides[rand];
+        this.settings.slides[rand] = temp;
+      }
+    },
+
+    play: function () {
+      if (this.paused) {
+        this.paused = false;
+        this.next();
+        this.trigger('play');
+      }
+    },
+
+    pause: function () {
+      this._timer(false);
+      this.paused = true;
+      this.trigger('pause');
+    },
+
+    toggle: function () {
+      if (this.paused) {
+        this.play();
+      } else {
+        this.pause();
+      }
+    },
+
+    playing: function () {
+      return !this.paused && !this.noshow;
+    },
+
+    current: function (advanced) {
+      if (advanced) {
+        return {
+          slide: this.slide,
+          data:  this.settings.slides[this.slide]
+        };
+      }
+      return this.slide;
+    },
 
-        previous: function () {
-            this.slide--;
+    jump: function (nb) {
+      if (nb < 0 || nb > this.total - 1 || nb === this.slide) {
+        return;
+      }
 
-            if (this.slide < 0) {
-                if (!this.settings.loop) {
-                    this.slide++;
-                    return;
-                } else {
-                    this.slide = this.total - 1;
-                }
-            }
+      this.slide = nb;
+      this._goto(this.slide);
+    },
 
-            this._goto(this.slide);
-        },
+    next: function () {
+      this.slide++;
 
-        trigger: function (fn) {
-            var params = [];
+      if (this.slide >= this.total) {
+        if (!this.settings.loop) {
+          return this._end();
+        }
 
-            if (fn === 'init') {
-                params = [ this.settings ];
-            } else {
-                params = [
-                    this.slide,
-                    this.settings.slides[this.slide]
-                ];
-            }
+        this.slide = 0;
+      }
 
-            this.$elmt.trigger('vegas' + fn, params);
+      this._goto(this.slide);
+    },
 
-            if (typeof this.settings[fn] === 'function') {
-                this.settings[fn].apply(this.$elmt, params);
-            }
-        },
+    previous: function () {
+      this.slide--;
 
-        options: function (key, value) {
-            var oldSlides = this.settings.slides.slice();
+      if (this.slide < 0) {
+        if (!this.settings.loop) {
+          this.slide++;
+          return;
+        } else {
+          this.slide = this.total - 1;
+        }
+      }
 
-            if (typeof key === 'object') {
-                this.settings = $.extend({}, defaults, $.vegas.defaults, key);
-            } else if (typeof key === 'string') {
-                if (value === undefined) {
-                    return this.settings[key];
-                }
-                this.settings[key] = value;
-            } else {
-                return this.settings;
-            }
+      this._goto(this.slide);
+    },
 
-            // In case slides have changed
-            if (this.settings.slides !== oldSlides) {
-                this.total  = this.settings.slides.length;
-                this.noshow = this.total < 2;
-                this._preload();
-            }
-        },
+    trigger: function (fn) {
+      var params = [];
 
-        destroy: function () {
-            clearTimeout(this.timeout);
+      if (fn === 'init') {
+        params = [ this.settings ];
+      } else {
+        params = [
+          this.slide,
+          this.settings.slides[this.slide]
+        ];
+      }
 
-            this.$elmt.removeClass('vegas-container');
-            this.$elmt.find('> .vegas-slide').remove();
-            this.$elmt.find('> .vegas-wrapper').clone(true).children().appendTo(this.$elmt);
-            this.$elmt.find('> .vegas-wrapper').remove();
+      this.$elmt.trigger('vegas' + fn, params);
 
-            if (this.settings.timer) {
-                this.$timer.remove();
-            }
+      if (typeof this.settings[fn] === 'function') {
+        this.settings[fn].apply(this.$elmt, params);
+      }
+    },
 
-            if (this.settings.overlay) {
-                this.$overlay.remove();
-            }
+    options: function (key, value) {
+      var oldSlides = this.settings.slides.slice();
 
-            this.elmt._vegas = null;
+      if (typeof key === 'object') {
+        this.settings = $.extend({}, defaults, $.vegas.defaults, key);
+      } else if (typeof key === 'string') {
+        if (value === undefined) {
+          return this.settings[key];
         }
-    };
-
-    $.fn.vegas = function(options) {
-        var args = arguments,
-            error = false,
-            returns;
-
-        if (options === undefined || typeof options === 'object') {
-            return this.each(function () {
-                if (!this._vegas) {
-                    this._vegas = new Vegas(this, options);
-                }
-            });
-        } else if (typeof options === 'string') {
-            this.each(function () {
-                var instance = this._vegas;
+        this.settings[key] = value;
+      } else {
+        return this.settings;
+      }
+
+      // In case slides have changed
+      if (this.settings.slides !== oldSlides) {
+        this.total  = this.settings.slides.length;
+        this.noshow = this.total < 2;
+        this._preload();
+      }
+    },
+
+    destroy: function () {
+      clearTimeout(this.timeout);
+
+      this.$elmt.removeClass('vegas-container');
+      this.$elmt.find('> .vegas-slide').remove();
+      this.$elmt.find('> .vegas-wrapper').clone(true).children().appendTo(this.$elmt);
+      this.$elmt.find('> .vegas-wrapper').remove();
+
+      if (this.settings.timer) {
+        this.$timer.remove();
+      }
+
+      if (this.settings.overlay) {
+        this.$overlay.remove();
+      }
+
+      this.elmt._vegas = null;
+    }
+  };
+
+  $.fn.vegas = function(options) {
+    var args = arguments,
+      error = false,
+      returns;
+
+    if (options === undefined || typeof options === 'object') {
+      return this.each(function () {
+        if (!this._vegas) {
+          this._vegas = new Vegas(this, options);
+        }
+      });
+    } else if (typeof options === 'string') {
+      this.each(function () {
+        var instance = this._vegas;
 
-                if (!instance) {
-                    throw new Error('No Vegas applied to this element.');
-                }
+        if (!instance) {
+          throw new Error('No Vegas applied to this element.');
+        }
 
-                if (typeof instance[options] === 'function' && options[0] !== '_') {
-                    returns = instance[options].apply(instance, [].slice.call(args, 1));
-                } else {
-                    error = true;
-                }
-            });
+        if (typeof instance[options] === 'function' && options[0] !== '_') {
+          returns = instance[options].apply(instance, [].slice.call(args, 1));
+        } else {
+          error = true;
+        }
+      });
 
-            if (error) {
-                throw new Error('No method "' + options + '" in Vegas.');
-            }
+      if (error) {
+        throw new Error('No method "' + options + '" in Vegas.');
+      }
 
-            return returns !== undefined ? returns : this;
-        }
-    };
+      return returns !== undefined ? returns : this;
+    }
+  };
 
-    $.vegas = {};
-    $.vegas.defaults = defaults;
+  $.vegas = {};
+  $.vegas.defaults = defaults;
 
-    $.vegas.isVideoCompatible = function () {
-        return !/(Android|webOS|Phone|iPad|iPod|BlackBerry|Windows Phone)/i.test(navigator.userAgent);
-    };
+  $.vegas.isVideoCompatible = function () {
+    return !/(Android|webOS|Phone|iPad|iPod|BlackBerry|Windows Phone)/i.test(navigator.userAgent);
+  };
 
 })(window.jQuery || window.Zepto);

Някои файлове не бяха показани, защото твърде много файлове са промени