File tree Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -731,16 +731,31 @@ Code related to auotplay features of the carousel
731
731
} ,
732
732
methods : {
733
733
autoplayStart : function ( ) {
734
+ // Don't loop if we only have one page
735
+ if ( this . pages <= 0 ) {
736
+ return ;
737
+ }
738
+
734
739
if ( this . autoplayDelay ) {
735
740
return this . autoPlayInterval = setInterval ( ( ) => {
736
741
if ( ! this . autoplayPaused ) {
737
- return this . next ( ) ;
742
+ return this . autoplayNext ( ) ;
738
743
}
739
744
} , this . autoplayDelay * 1000 ) ;
740
745
}
741
746
} ,
742
747
autoplayStop : function ( ) {
743
748
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
+ }
744
759
}
745
760
}
746
761
} ) ;
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " vue-ssr-carousel" ,
3
- "version" : " 0.3.0 " ,
3
+ "version" : " 0.3.1 " ,
4
4
"description" : " A performance focused Vue carousel designed for SSR/SSG environments." ,
5
5
"main" : " index.js" ,
6
6
"scripts" : {
You can’t perform that action at this time.
0 commit comments