SwiperJS Assistance

Hello, is anyone here familiar with SwiperJS? I seem to be unable to find any way to update "freeMode" after initialization. I'm able to do this for "mousewheel" with swiper.mousewheel.disable(). yet there seems to be no equivelant for freeMode. Any ideas are appreciated
49 Replies
ἔρως
ἔρως3mo ago
and where can we see this issue happening? any live examples?
Schroedinger
SchroedingerOP3mo ago
It isn't so much of an issue as it is a lack of documentation. However, I managed to find a workaround by toggling a class If you're familiar with swiperjs I'm happy to make a demo of what I'm trying to do, but essentially I'm just initializing it like this
let swiper = new Swiper('.swiper', {
freeMode: {
enabled: true,
sticky: true,
}
});
let swiper = new Swiper('.swiper', {
freeMode: {
enabled: true,
sticky: true,
}
});
and then attempting to update the "enabled" value. And I'm unable to find any official way of doing this besides my workaround. Which I find strange, since I'm able to do precisely this with "swiper.mousewheel.disable()"
ἔρως
ἔρως3mo ago
🤔
Schroedinger
SchroedingerOP3mo ago
If you know any better way of doing it definitely let me know
ἔρως
ἔρως3mo ago
there's an enable method
Schroedinger
SchroedingerOP3mo ago
Yep but that's with mousewheel, my bad, I didn't clarify, mousewheel is another option I'm using along with freeMode, that I don't have any issues with. I was just using it as an example of what I'd like to do with freeMode I need exactly these methods but for freeMode or an equivalent
ἔρως
ἔρως3mo ago
you said "mousewheel" here, at the end
Schroedinger
SchroedingerOP3mo ago
Yes, I was showing you an example of what I want to do with freeMode I want to use the same methods that I can use on mousewheel, but on freeMode But freeMode doesn't seem to have these methods, so I'm looking for an equivalent
ἔρως
ἔρως3mo ago
yeah, the documentation seems to be broken
Schroedinger
SchroedingerOP3mo ago
Yeah they're not very good unfortunately I've had to do so many workarounds with swiperjs already its a really good library besides the lack of documentation
ἔρως
ἔρως3mo ago
GitHub
swiper/src/types/modules/free-mode.d.ts at master · nolimits4web/sw...
Most modern mobile touch slider with hardware accelerated transitions - nolimits4web/swiper
ἔρως
ἔρως3mo ago
the code seems wrong you have the enabled property can you try setting it directly?
Schroedinger
SchroedingerOP3mo ago
Like with swiper.freeMode.enabled = false? I've tried this, but "enabled" isn't part of freeMode when I try accessing it outside of the initialization
ἔρως
ἔρως3mo ago
the types must be all busted then
Schroedinger
SchroedingerOP3mo ago
No description
Schroedinger
SchroedingerOP3mo ago
I simply get these 3 methods
ἔρως
ἔρως3mo ago
and what's in the prototype?
Schroedinger
SchroedingerOP3mo ago
No description
Schroedinger
SchroedingerOP3mo ago
I'm not exactly sure what to make of these
ἔρως
ἔρως3mo ago
just a normal object prototype yeah, seems like a bug maybe you should file an issue on github
Schroedinger
SchroedingerOP3mo ago
just for comparison:
No description
Schroedinger
SchroedingerOP3mo ago
What if they didn't intend to allow the user to disable it for whatever reason?
ἔρως
ἔρως3mo ago
then they don't and you found a workaround
Schroedinger
SchroedingerOP3mo ago
I suppose thanks for your help regardless
ἔρως
ἔρως3mo ago
just make an issue with this inconsistency and dont talk about your workaround, so you have a working solution, for now
Schroedinger
SchroedingerOP3mo ago
Haha I won't thanks
ἔρως
ἔρως3mo ago
actually, lock your version and report the workaround too so you can always have a working solution, and the workaround gets fixed
Schroedinger
SchroedingerOP3mo ago
that works too
ἔρως
ἔρως3mo ago
it's a better solution https://github.com/nolimits4web/swiper/blob/master/src/modules/free-mode/free-mode.mjs <-- by the way, it seems there's no actual way to disable it
Schroedinger
SchroedingerOP3mo ago
very strange I can't imagine no one ever faced this issue before
ἔρως
ἔρως3mo ago
i cant imagine it too
vince
vince3mo ago
fwiw and doesn't answer your question, but I feel your frustration with SwiperJS 😅 works great when it works and not so much when it doesn't
Schroedinger
SchroedingerOP3mo ago
Haha yeah I'm heavily considering just writing my own swiper at this point. This isn't my first battle with SwiperJS either, my current project is full of workarounds to counter SwiperJS' lack of customization/documentation
ἔρως
ἔρως3mo ago
this isn't a lack of documentation or customization: it's a lack of a very basic feature did you filed an issue?
Schroedinger
SchroedingerOP3mo ago
Agreed and I'm in the process of doing so
ἔρως
ἔρως3mo ago
awesome!
Schroedinger
SchroedingerOP3mo ago
Are you certain there is no duplicate issue? I can't seem to find any but just making sure as I usually don't do this
vince
vince3mo ago
check with is:closed if you haven't already Worst case if it's a duplicate they'll link to it when they review it
ἔρως
ἔρως3mo ago
not really, but if there's a duplicate one, it will be closed you did your best effort and that's important your due diligence
Schroedinger
SchroedingerOP3mo ago
GitHub
Unable to modify freeMode.enabled after initialization · Issue #775...
Check that this is really a bug I confirm Reproduction link https://codepen.io/quill-quarius/pen/ExqjKrP?editors=1111 Bug description There seem to be no methods allowing one to change the "en...
Schroedinger
SchroedingerOP3mo ago
cannot wait to be yelled at for improperly opening an issue in some way yeah it really doesn't seem like anyone else has how strange It seems like quite a well known library does everyone just deal with it by making workaroudns haha thank you
ἔρως
ἔρως3mo ago
lets just say that most people follow 2 paths: 1- use something else 2- just grumble and use workarounds it's rare for people to open issues
Schroedinger
SchroedingerOP3mo ago
Yeah I suppose, although I also understand why It is very common for developers to take issue formatting super serious and discourage any future issue posting. Even for simply requesting help in some discord server just like with stackoverflows reputation
ἔρως
ἔρως3mo ago
i agree, it discourages but some people go waaaaaaaaaaaaaaaaaaaaaay overboard if you don't dot your t's and cross your i's, your issue is deleted
Schroedinger
SchroedingerOP3mo ago
haha comes from a lack of control in other matters in life I suppose
ἔρως
ἔρως3mo ago
maybe, or tired of people putting the foot on their mouth with simpler instructions
Schroedinger
SchroedingerOP3mo ago
perhaps
ἔρως
ἔρως3mo ago
i understand it, it's what i mean
Want results from more Discord servers?
Add your server