|
@@ -119,9 +119,10 @@
|
|
|
var $wrapper,
|
|
|
$overlay,
|
|
|
$timer,
|
|
|
- isBody = this.elmt.tagName === 'BODY',
|
|
|
- timer = this.settings.timer,
|
|
|
- overlay = this.settings.overlay;
|
|
|
+ isBody = this.elmt.tagName === 'BODY',
|
|
|
+ timer = this.settings.timer,
|
|
|
+ overlay = this.settings.overlay,
|
|
|
+ self = this;
|
|
|
|
|
|
// Preloading
|
|
|
this._preload();
|
|
@@ -166,12 +167,19 @@
|
|
|
|
|
|
// Container
|
|
|
this.$elmt.addClass('vegas-container');
|
|
|
+
|
|
|
if (!isBody) {
|
|
|
this.$elmt.append($wrapper);
|
|
|
}
|
|
|
|
|
|
- this.trigger('init');
|
|
|
- this._goto(this.slide);
|
|
|
+ setTimeout(function () {
|
|
|
+ self.trigger('init');
|
|
|
+ self._goto(self.slide);
|
|
|
+
|
|
|
+ if (self.settings.autoplay) {
|
|
|
+ self.trigger('play');
|
|
|
+ }
|
|
|
+ }, 1);
|
|
|
},
|
|
|
|
|
|
_preload: function () {
|
|
@@ -539,7 +547,9 @@
|
|
|
trigger: function (fn) {
|
|
|
var params = [];
|
|
|
|
|
|
- if (fn !== 'init') {
|
|
|
+ if (fn === 'init') {
|
|
|
+ params = [ this.settings ];
|
|
|
+ } else {
|
|
|
params = [
|
|
|
this.slide,
|
|
|
this.settings.slides[this.slide]
|