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

Add option to customize aria-label for dots #246

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -115,7 +115,10 @@ new Glider(document.querySelector('.glider'), {
slidesToScroll: 3
}
}
]
],

// Aria label prefix for dot
dotLabel: "Slide "
});
```

2 changes: 1 addition & 1 deletion docs/assets/js/glider.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions docs/index.html
Original file line number Diff line number Diff line change
@@ -952,6 +952,12 @@ <h2>Settings</h2>
Whether or not Glider.js should skip wrapping its children with a 'glider-track' &lt;div&gt;.
<span class="aside">NOTE: If true, Glider.js will assume that the 'glider-track' element has been added manually. All slides must be children of the track element.</span>
</li>
<li>
<span class="setting-name">dotLabel</span><br>
<span class="type">Type:</span> <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a><br>
<span class="type default">Default:</span>Page <br>
Aria label prefix for dot
</li>

</ul>
</section>
2 changes: 1 addition & 1 deletion glider.js
Original file line number Diff line number Diff line change
@@ -224,7 +224,7 @@
for (var i = 0; i < Math.ceil(_.slides.length / _.opt.slidesToShow); ++i) {
var dot = document.createElement('button')
dot.dataset.index = i
dot.setAttribute('aria-label', 'Page ' + (i + 1))
dot.setAttribute('aria-label', (_.opt.dotLabel ? _.opt.dotLabel : 'Page ') + (i + 1))
dot.setAttribute('role', 'tab')
dot.className = 'glider-dot ' + (i ? '' : 'active')
_.event(dot, 'add', {
2 changes: 1 addition & 1 deletion glider.min.js