swiper

Open full view…

PrevEl and nextEl not working

noobishpro
Wed, 10 Jan 2018 22:47:28 GMT

scheduleSwiper = new Swiper('#schedule_swiper', { init: false, initialSlide: currentSwiperIndex, width: device_width(), spaceBetween: 0, navigation: { nextEl: "#schedule_next", prevEl: "#schedule_prev" }, centeredSlides: true }); Using swiper's latest version (4.0.7) So, this (above) is my code to init the swiper. I've switched from 3.4.7 and must say that I'm bumping up against a whole lot of bugs. However, I've found a way around most of them. Now, however, suddenly the next and previous buttons (custom) don't work anymore. They aren't inside the #scheduleswiper wrapper, but that shouldn't matter, should it? They did work with this version before. I'm unsure of what I have done wrong to find out they aren't working anymore.

noobishpro
Wed, 10 Jan 2018 23:37:38 GMT

I have currently fixed this by setting a custom binding in combination with swiper.slideNext and slidePrev

yadin
Sun, 04 Feb 2018 16:51:35 GMT

i was facing the same problem. maybe your container is in display:"none" ?

noobishpro
Mon, 05 Feb 2018 16:13:27 GMT

@yadin if this is something to cause that problem, that may indeed be the case. The parent containers start as display:none; However, I fixed it myself by binding lose elements on my on (on the click event) and then triggering swiper.nextSlide();

yadin
Mon, 05 Feb 2018 16:15:26 GMT

nice. that was my problem and i was for 6 hours try to fix it. until i found out that my container was "display: none" , try to use "visability:hidden" instead.

noobishpro
Mon, 05 Feb 2018 16:44:07 GMT

in my case, it was pretty important for the page loading speed that it was on display:none. visibility:hidden still renders it, which will cause a pretty heavy load-time in my swiper case.