In v5 my swiper slides on doubleTap were working perfect in v6 they stop working so I tried to pass $f7, $, $on as parameter to the action in store.js but it seems not to be working…
any ideas how to make doubleTap to work again in v6?
what changed for this in v6?
I checked documentation about migration to v6 and others documents online but regarding swiper slider nothing mentioned that changed in v6…
initHotels({ state }, { $f7, $, $on }) {
...
var swiper_hotels = $f7.swiper.create(
'.swiper-container.hotels', {
lazy: {
threshold: 50,
observer: true,
loadPrevNext: true,
loadPrevNextAmount: 4,
},
scrollbar: {
el: '.swiper-scrollbar',
hide: true,
},
centeredSlides: false,
watchSlidesVisibility: true,
preloadImages: false,
lazy: true,
loop: false,
slidesPerView: 'auto',
spaceBetween: 5,
pagination: {
el: '.swiper-pagination',
dynamicBullets: true,
clickable: true,
},
scrollbar: {
el: '.swiper-scrollbar',
hide: true,
},
on: {
init: function () {
var swiper_hotels = $f7.swiper.get('.swiper-container.hotels');
swiper_hotels.slideTo(0, '2500');
swiper_hotels.update();
},
reachBeginning: function (e) {},
reachEnd: function (e) {},
observerUpdate: function (e) {},
tap: function (e) {
if (e.type == "dblclick") return;
},
doubleTap: function (e) {
var $ = this.$; //working in v5 not in v6
//this lines below working in v5 but not in v6
if ($(e.target).closest(".swiper-slide").attr('data-id')) {
var hotel_id = $(e.target).closest(".swiper-slide").attr('data-id');
setTimeout(function () {
$f7.views.main.router.navigate('/hotel/' + hotel_id + '/');
}, 500);
}
},
}
});