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

Feature Request: differentiate "active" and "inactive" controls #138

Open
hchargois opened this issue Dec 2, 2015 · 4 comments
Open

Feature Request: differentiate "active" and "inactive" controls #138

hchargois opened this issue Dec 2, 2015 · 4 comments
Assignees

Comments

@hchargois
Copy link

To improve the meaningfulness of the 'js_prev' and 'js_next' controls, one should be able to style them differently if they are "active" or not, that is, if clicking them will actually move the slider or not.

For example, the 'js_prev' control does nothing when the slider is at the start position, but the 'js_next' will move the slider, and you may want to show a dull grey left chevron and a bold black right chevron. There should be something such as an 'active' or 'inactive' class (or both) that get added and removed from 'js_{prev,next}' as needed, so that this kind of styling is possible.

@meandmax
Copy link
Collaborator

Hey @hchargois,

you could do this by using returnIndex and compare the value with the total length of the slides or zero! And I would do this always on "after.lory.slide".

If "infinite" is false, and the returned index is either 0 or the max length of your slides, then you add/remove a class which shows the active/inactive state.

Does this help?

@hchargois
Copy link
Author

Hi,
I thought about doing it this way but:

  1. This doesn't work when slidesToScroll > 1. And there's no easy fix such as adding the number of slidesToScroll to the returnIndex or something, because returnIndex is inherently broken at the end of the carousel (after the last slide action that slides to the complete end of the carousel, returnIndex is the same as the previous slide). For this to work well and easy enough, the API should have something such as atStart and atEnd that returns the corresponding truth values.
  2. It's a bit complicated for a feature I think is elementary. I understand that you want people to use the API to extend the functionality but since controls were deemed so common that they were built into lory (they could have been left to the user to build with the API instead), then those controls should be powerful enough to cover such a common "enabled/disabled styling" use case. In my opinion it's just as useful as setting an "active" class to the current slide.

@meandmax
Copy link
Collaborator

Hey @hchargois,

sorry for the late answer! Yes u are right so since the controls are already integrated in lory I totally understand your point. So if u want and still need this feature, make a pull-request on that.

Thanks for contributing!
Max

@nstanard nstanard self-assigned this Nov 28, 2016
@maximerabot
Copy link

Any updates about this features? Can we now hide controls when they are not "active"?

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

No branches or pull requests

4 participants