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

Enhancement proposal: labelled dots #198

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

aurovrata
Copy link
Contributor

I have a request from some clients to enable labels in slider dots to make it more obvious the slide number.

I though this could be a useful feature for the rest of the community, hence here is what I propose:

introduce a new settings:

_.opt.labelDots = false | []

by default the labeDots is false and the dots appear as they currently are.

However, a user can parse an empty array or a an array of custom labels. In both cases an additional class is added to the dot container label-dots so as to ensure the dots are large enough to envelope the labels with the following additional rule in css stylesheet:

.label-dots .glider-dot {
	width: 1.1rem;
	height: 1.1rem;
	font-size: 1rem;
	line-height: 1;
	padding-bottom: 2px;
}

If the option labelDots is an empty array, the dot.innerText is set to the current slide index (+1), else if a corresponding label exist in the passed array, then that value is used instead.

aurovrata and others added 8 commits September 20, 2020 22:16
add a slide index data attribute to each slide upon initialisation.

line 103,
[].forEach.call(_.slides, function (_) {
      _.classList.add('glider-slide')
})

changed to 

 [].forEach.call(_.slides, function (_,i) {
      _.classList.add('glider-slide');
      _.setAttribute('data-gslide',i)
    })
slide index attribute
@NickPiscitelli
Copy link
Owner

Thanks for this PR, definitely appreciated! As opposed to adding to the core plugin, I think we should make a Playground section for the docs and add great examples like this to it. I think this is achievable by using the existing methods, but we may need to make a tweak to core to facilitate.

@aurovrata
Copy link
Contributor Author

I think this is achievable by using the existing methods, but we may need to make a tweak to core to facilitate.

great. Do keep me posted. I will happily contribute to the docs too.

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

Successfully merging this pull request may close these issues.

2 participants