Skip to content

Commit 99b0ed4

Browse files
committed
0.3.1
1 parent 6562280 commit 99b0ed4

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

index.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -731,16 +731,31 @@ Code related to auotplay features of the carousel
731731
},
732732
methods: {
733733
autoplayStart: function () {
734+
// Don't loop if we only have one page
735+
if (this.pages <= 0) {
736+
return;
737+
}
738+
734739
if (this.autoplayDelay) {
735740
return this.autoPlayInterval = setInterval(() => {
736741
if (!this.autoplayPaused) {
737-
return this.next();
742+
return this.autoplayNext();
738743
}
739744
}, this.autoplayDelay * 1000);
740745
}
741746
},
742747
autoplayStop: function () {
743748
return clearInterval(this.autoPlayInterval);
749+
},
750+
autoplayNext: function () {
751+
var nextIndex;
752+
nextIndex = this.index + 1;
753+
754+
if (nextIndex < this.pages) {
755+
return this.next();
756+
} else {
757+
return this.goto(0);
758+
}
744759
}
745760
}
746761
});

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vue-ssr-carousel",
3-
"version": "0.3.0",
3+
"version": "0.3.1",
44
"description": "A performance focused Vue carousel designed for SSR/SSG environments.",
55
"main": "index.js",
66
"scripts": {

0 commit comments

Comments
 (0)