@averta
I want to use the following function to create a Play/Pause toggle function:
function(event) {
var api = event.target;
var autoplay = true;
var mySlider;
if(typeof api !== 'undefined') {
mySlider = api;
} else {
return;
}
var isPlaying = autoplay,
playPause = jQuery('<div class="prefix-play-pause" />'),
play = jQuery('<div class="prefix-play" />').appendTo(playPause),
pause = jQuery('<div class="prefix-pause" />').appendTo(playPause);
if(!autoplay) {
pause.hide();
play.show();
}
playPause.on('click', function() {
if(isPlaying) {
pause.hide();
play.show();
mySlider.pause();
} else {
play.hide();
pause.show();
mySlider.resume();
}
isPlaying = !isPlaying;
}).appendTo(jQuery('.ms-view'));
}
I’m using this with the on slider init
callback but it doesn’t seem to be loading. This function worked with the on slide change start
callback, but it was repeating the function after every slide transition.
How can I get this working with the on slider init
callback?