diff --git a/README.md b/README.md index 76de7cac..cca006aa 100644 --- a/README.md +++ b/README.md @@ -114,6 +114,9 @@ var flky = new Flickity( '.gallery', { // set img data-flickity-lazyload="src.jpg" // set to number to load images adjacent cells + nextButtonAriaLabel: 'Next', + // sets next button aria-label + percentPosition: true, // sets positioning in percent values, rather than pixels // Enable if items have percent widths @@ -122,6 +125,9 @@ var flky = new Flickity( '.gallery', { prevNextButtons: true, // creates and enables buttons to click to previous & next cells + prevButtonAriaLabel: 'Previous', + // sets previous button aria-label + pageDots: true, // create and enable page dots diff --git a/js/flickity.js b/js/flickity.js index d06387be..4bdcef10 100644 --- a/js/flickity.js +++ b/js/flickity.js @@ -105,9 +105,11 @@ Flickity.defaults = { percentPosition: true, resize: true, selectedAttraction: 0.025, - setGallerySize: true + setGallerySize: true, // watchCSS: false, // wrapAround: false + prevButtonAriaLabel: 'Previous', + nextButtonAriaLabel: 'Next' }; // hash of methods triggered on _create() diff --git a/js/prev-next-button.js b/js/prev-next-button.js index 058eef1d..f816551b 100644 --- a/js/prev-next-button.js +++ b/js/prev-next-button.js @@ -59,7 +59,10 @@ PrevNextButton.prototype._create = function() { // init as disabled this.disable(); - element.setAttribute( 'aria-label', this.isPrevious ? 'Previous' : 'Next' ); + var prevButtonAriaLabel = this.parent.options.prevButtonAriaLabel; + var nextButtonAriaLabel = this.parent.options.nextButtonAriaLabel; + + element.setAttribute( 'aria-label', this.isPrevious ? prevButtonAriaLabel : nextButtonAriaLabel ); // create arrow var svg = this.createSVG(); diff --git a/test/index.html b/test/index.html index 8e6a9160..48004c01 100644 --- a/test/index.html +++ b/test/index.html @@ -36,6 +36,12 @@ + + +