splide.go() not responding when using a string as the first argument #1354
Unanswered
mainiomooses
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello and thank you for an amazing tool.
As per the documentation (https://splidejs.com/components/controller/#go) .go() takes a number or a string as it's first argument - however if you do give it a string, there is no result. The slider doesn't budge, no error message either.
In my use case, upon getting an index number from a dropdown item, getting a value from a prop set on each dropdown option element in data-index, on dropdown element change (string containing an integer), the splide is moved via .go() to scroll into view the matching slide. Banged my head for a bit, also using the browser console to manually command the instance to see if I have access to it, which I did.
It was only when trying myVar = Number(myVar); when splide started to react to .go(myVar); and functioning as expected from thereon.
You can easily test this from the console, using splide.go("1"); and splide.go(1); - the former produces no result. You can also tests it by assigning an integer as a string to a variable and trying to use that to .go(), it's a no-go.
Beta Was this translation helpful? Give feedback.
All reactions