vue-carousel icon indicating copy to clipboard operation
vue-carousel copied to clipboard

Feature: Infinite loop without scrolling back

Open stereolith opened this issue 6 years ago • 19 comments

Description

This is a PR to implement infinite looping without scrolling back.

This feature works by modfying the slides array ($slots.default) to triple its contents:

1 -> 2 -> 3 -> 1 -> 2 -> 3 -> 1 -> 2 -> 3

The default position of the carousel should be any of the middle slides (bold), so that there is always a way to move left or right out of the bounds of the slider. If the carousel reaches a position outside of the middle third of the slide array, the currentPage quietly jumps to the corresponding slide in the middle third, after the transition ended. As the slide count triples, pageCount is multiplied as well so under the hood currentPage will be in the range of 0 - triple the original pageCount. To accomodate this, the pagination component had to be modified as well.

Motivation and Context

solves issue: #288 @MartinGerritsen 's PR (#316) had some open issues so I tried my luck with this approach.

How Has This Been Tested?

This has been tested in the vue play environment. Tested with pagination and navigation elements.

By editing the slides array itself, this is a major change affecting some of the carousel component data object's properties, such as pageCount and currentPage. This probably needs further testing to prevent possible interference with other features.

Types of changes

  • [ ] Bug fix (non-breaking change which fixes an issue)
  • [ x ] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • [ x ] My code follows the code style of this project.
  • [ x ] My change requires a change to the documentation.
  • [ x ] I have updated the documentation accordingly.
  • [ x ] I have included a vue-play example (if this is a new feature)

stereolith avatar Jan 18 '19 22:01 stereolith

Coverage Status

Coverage decreased (-2.9%) to 64.826% when pulling 868e1a94ba8aba8b7d2c372bc2c9e9bef6889b8d on stereolith:master into 0d3840982eb0e8e1ae14d0fdcb06f8bba07e2f9e on SSENSE:master.

coveralls avatar Jan 18 '19 22:01 coveralls

Hey @stereolith, thanks so much for submitting this! I'll test the feature with @ashleysimpson tomorrow when I get into the office - I've got some questions, but I'll wait until after we've tested in case they answer themselves. This is a really sought after feature, so super glad you're able to help out :octocat:

quinnlangille avatar Jan 20 '19 21:01 quinnlangille

In which version this feature will be available?

davision avatar Jan 22 '19 12:01 davision

Assuming manual tests go over and we have no requests for changes, should be in the next release @davision. Likely in the next week or two. Feel free to follow along with this PR thread for updates!

quinnlangille avatar Jan 22 '19 16:01 quinnlangille

Great! Looking very much forward.

davision avatar Jan 23 '19 08:01 davision

@stereolith Noticed code refactoring on master branch, can you merge and verify your changes still work?

AhiVT avatar Feb 14 '19 22:02 AhiVT

@stereolith any progress? Could you merge it? I can fix those conflicts for you.

krystian50 avatar Jul 19 '19 07:07 krystian50

@stereolith Please could you merge this feature?

mass22 avatar Jul 30 '19 13:07 mass22

Hey there!

Any updates on this issue?

Thanks!

iRaul avatar Sep 12 '19 10:09 iRaul

Would love to see this feature merged.

Thanks!

remotelydev avatar Nov 11 '19 17:11 remotelydev

Is there any reason this isn't merged yet? Would be a great feature to have! :)

JWardee avatar Feb 11 '20 13:02 JWardee

Can this feature be merged please ?

benjaminroy avatar May 11 '20 22:05 benjaminroy

@quinnlangille could you merge this pull request, please?

thamerbelfkihthamer avatar Jun 06 '20 23:06 thamerbelfkihthamer

For everyone here and in issue #288, this PR introduces a bug when combined with :scrollPerPage="false" – it does weird things. I would not recommend merging this PR in its current state.

jeff-kroot avatar Jun 16 '20 11:06 jeff-kroot

Would love it if this is merged before the end of August when we release!

miainchambers avatar Aug 11 '20 16:08 miainchambers

Please merge

frizar avatar Sep 17 '20 10:09 frizar

Please Merge!

boehsermoe avatar Oct 05 '20 11:10 boehsermoe

Please Merge!

hoangbaovu avatar Oct 18 '20 18:10 hoangbaovu

Please Merge!

jun1orDev avatar Jun 27 '22 13:06 jun1orDev