I'm using the bxslider plugin, and have created some external controls for the previous and next function, although I cant seem to figure out how to do the same with the start/stop control.
Basically I want to use this as a play/pause function for the slider.
Does anyone have any experience with this plugin?
Here's what I have so far, without the start/stop function working:
Also, I want the slider to "auto" play, as well a having this external controls. I just noticed that clicking on any of my links seems to disable the auto play, and I have to refresh the page to get it back.
I don't know if you still need an answer to this, but if you update your code to this, it should work:
var slider = $('#bxslider').bxSlider({
auto: true,
controls: false
});
$('#go-prev').click(function(){
slider.goToPreviousSlide();
slider.startShow(); //added this line
return false;
});
$('#go-next').click(function(){
slider.goToNextSlide();
slider.startShow(); //added this line
return false;
});
$('#my-start-stop').click(function(){
/* added a class to your #my-start-start a tag called "stopShow", note: would recommend that you also change the text to say "Stop" when the show is active and "Start" when the show is not. :) */
if($('#my-start-stop').attr('class') == 'stopShow'){
slider.stopShow();
$('#my-start-stop').removeClass('stopShow');
} else {
slider.startShow();
$('#my-start-stop').addClass('stopShow');
}
return false;
});