vue-carousel
vue-carousel copied to clipboard
Feature: Infinite loop without scrolling back
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)
Coverage decreased (-2.9%) to 64.826% when pulling 868e1a94ba8aba8b7d2c372bc2c9e9bef6889b8d on stereolith:master into 0d3840982eb0e8e1ae14d0fdcb06f8bba07e2f9e on SSENSE:master.
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:
In which version this feature will be available?
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!
Great! Looking very much forward.
@stereolith Noticed code refactoring on master branch, can you merge and verify your changes still work?
@stereolith any progress? Could you merge it? I can fix those conflicts for you.
@stereolith Please could you merge this feature?
Hey there!
Any updates on this issue?
Thanks!
Would love to see this feature merged.
Thanks!
Is there any reason this isn't merged yet? Would be a great feature to have! :)
Can this feature be merged please ?
@quinnlangille could you merge this pull request, please?
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.
Would love it if this is merged before the end of August when we release!
Please merge
Please Merge!
Please Merge!
Please Merge!