Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue when looping activated #112

Closed
rodrilinares opened this issue Dec 12, 2022 · 2 comments · Fixed by #118
Closed

Issue when looping activated #112

rodrilinares opened this issue Dec 12, 2022 · 2 comments · Fixed by #118

Comments

@rodrilinares
Copy link

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch [email protected] for the project I'm working on.

The problem that I faced with is when you try to go back having looping property activated. The problem is that the slide goes to the last one, which is ok, but the dots shown the second index as you can see in the next video.

Screen.Recording.2022-12-12.at.1.52.03.PM.mov

I've "fixed" this problem with the following code, but doesn't fix it at all because the slide animation move forward instead of backward. Maybe you can improve this fix and fix it at all to make this library more robust.

Here is the diff that solved my problem:

diff --git a/node_modules/vue-ssr-carousel/index.js b/node_modules/vue-ssr-carousel/index.js
index ae566a2..9e5de4f 100644
--- a/node_modules/vue-ssr-carousel/index.js
+++ b/node_modules/vue-ssr-carousel/index.js
@@ -1747,6 +1747,9 @@ Code related to dealing with advancing between pages
     },
     // Go to a specific index
     goto: function (index) {
+      if (index < 0) {
+        index = this.pages - Math.abs(index % this.pages);
+      }
       this.index = this.applyIndexBoundaries(index);
       return this.tweenToIndex(this.index);
     },

This issue body was partially generated by patch-package.

@edos21
Copy link

edos21 commented Dec 12, 2022

awesome job here, we have the same issue and is very confusing for the users. Thanks!

LGTM!!

@DeviLaw
Copy link

DeviLaw commented Dec 12, 2022

I have the same problem 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants