I was able to do a bit of a hack to detect the page change.
Swiper adds the CSS class swiper-slide-active
to the active page, so I am checking if a slide has that class and if so changing the image to reflect this page change.
var mySwiper = new Swiper('.swiper-container',{
onSlideChangeEnd : function(swiperHere) {
changeNav();
var swiperPage = mySwiper.activeSlide()
console.log(swiperPage);
}
});
function changeNav() {
if ($('#pageTwo').hasClass("swiper-slide-active")) {
console.log('page is 2');
$('.navbar').attr("src","navbar-secondpage.png");
}
else {
console.log('page is 1');
$('.navbar').attr("src","navbar-firstpage.png");
}
};
If you have more than one page you could use a try catch statement.