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

When there are multiple instances of the carrousel on one page, the logic for hiding controls when a carrousel only contains one item fails #18

Open
martijnv opened this issue Aug 16, 2018 · 2 comments

Comments

@martijnv
Copy link

martijnv commented Aug 16, 2018

When there are multiple instances of the carrousel on one page, the logic for hiding controls when a carrousel only contains one item fails.

I suspect the line:

if ($carrousel_container.length && $carrousel_content.length > 1)

is incorrect or insufficient because carrousel_content.length is checked on the entire document instead of on a per carrousel-instance basis. When you have multiple carrousel instances in a document, the carrousel_content.length will always be > 1.

@martijnv
Copy link
Author

I fixed this by adding

if ($this_carrousel_container.find('.carrousel__content').length > 1) { }

around the building up the navigation and the prev/next buttons within
$carrousel_container.each(function(index_carrousel_container) {

So before line 88 and after line 155

@martijnv
Copy link
Author

And you can probably revert line 25 (remove the "> 1").

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

No branches or pull requests

1 participant