I am using google maps to list all my hotels with markers that has an infowindow customized with a click event.
I had to use window.slideToHotel function on Pageinit like this for the click inside infowindow to work, the function runs now but the swiper.slideTo gives me the following error:
TypeError: undefined is not an object (evaluating ‘swiper.slideTo’)
this is the function onclick:
window.slideToHotel = function(to) {
console.log(to) //this print OK
swiper.slideTo(to, 1000, true); //this line does not work
}
this is the swiper init to create the swiper:
var swiper = new Swiper('.swiper-container', {
spaceBetween: 0,
slidesPerView: 1,
slideToClickedSlide: true,
loop: false,
lazy: true
});
the idea here it is show on google maps the hotels using markers and onclick the link inside the infowindow for that marker then I need to slide to the slide that contains the hotel information inside the swiper gallery located below the map view.
The screen shows 50% height half of the screen the google map and below the swiper gallery with hotels images.
any ideas how to make work slideTo inside this function using window ?