Vue-carousel: Feature Request: Optionally disable animation on ':navigateTo' prop

Created on 8 Aug 2018  路  6Comments  路  Source: SSENSE/vue-carousel

I'm looking for a way to initialize the carousel at a given page number. In my case, I want to show the last slide immediately when my component is loaded.

I've looked at the navigateTo property. This works, but it has the disadvantage that you see the animation: the carousel moves to the last page while sliding through all previous pages.

Other things I tried:
The following does not work (currentPage is updated but the correct page isn't shown):

mounted() {
  this.$refs.carousel.goToPage(lastPageIndex);
}

The following works, but it also shows the animation:

mounted() {
    this.$nextTick(() => {
      this.$refs.carousel.goToPage(lastPageIndex);
    });
}

Related to this and this issue, but neither of them solved the problem.

feature good first issue help wanted

Most helpful comment

Hey @fikkatra, this functionality isn't currently supported but would likely be easy to engineer. I'll flag this as a feature request.

I would envision navigateTo to simply take an optional display toggle, i.e

:navigateTo= [1, false]

That's just the first thing that comes to mind, so if anyone has another idea feel free to submit a PR and I'll review right away :~)

All 6 comments

Hey @fikkatra, this functionality isn't currently supported but would likely be easy to engineer. I'll flag this as a feature request.

I would envision navigateTo to simply take an optional display toggle, i.e

:navigateTo= [1, false]

That's just the first thing that comes to mind, so if anyone has another idea feel free to submit a PR and I'll review right away :~)

Just released @utkarshnag's feature for this! Going to close the issue, feel free to comment here if there are any questions :octocat:

It seems that though the implementation of the feature has been merged, the prop type of navigateTo is still a Number, therefore a Invalid prop: type check failed error is being fired if you pass the array to it.

Can you please change it to [Number, Array]?

Good call @cvetkovskin! Missed that in review, I'll make a fix later today

@quinnlangille @ashleysimpson don't forget this one please ;)

@quinnlangille @ashleysimpson
I fixed the issue and created a PR that fixes the issue and includes the missing readme update

https://github.com/SSENSE/vue-carousel/pull/366

Btw thank you for your work here!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

christophrumpel picture christophrumpel  路  4Comments

hdodov picture hdodov  路  5Comments

blackforestcode picture blackforestcode  路  4Comments

valeriy-efimov picture valeriy-efimov  路  5Comments

lggwettmann picture lggwettmann  路  5Comments