Created
July 24, 2018 17:32
-
-
Save joelhsmith/62e39463840aa91e7cc632b986f1e432 to your computer and use it in GitHub Desktop.
Flexslider initialization that adds aria attributes and improves it's accessibility
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(function() { | |
// NOTE: I suggest using this in addition to my Fork of the Flexslider library: | |
// https://github.com/jhc36-duke-edu/FlexSlider (This Fork fixes empty link problems that cannot be fixed through the api.) | |
$('.flexslider').flexslider({ | |
slideshow: false, | |
prevText: "Previous slide", | |
nextText: "Next slide", | |
animation: "fade", | |
pausePlay: true, | |
pauseText: 'Pause Slideshow', | |
playText: 'Play Slideshow', | |
pauseInvisible: true, | |
animationLoop: false, | |
slideshowSpeed: 5000, | |
animationSpeed: 1000, | |
keyboard: false, | |
start: function(slider){ | |
console.log('flex start'); | |
current = slider.slides.eq(slider.currentSlide); | |
current.attr('aria-hidden', 'false'); | |
current.siblings().attr('aria-hidden', 'true'); | |
}, | |
after: function(slider){ | |
current = slider.slides.eq(slider.currentSlide); | |
current.attr('aria-hidden', 'false'); | |
current.siblings().attr('aria-hidden', 'true'); | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment