how to run functions on splide events without "var splide = new Splide" ?
Hi again, I`m kind of a newbie to js and I need to trigger one of the Api without declaraing a variable.
According to the splide documentaion this is how to "do something" after the slide moves:
var splide = new Splide( '#splide' ).mount(); splide.on( 'moved', function() { // do something } );
But how can I call that "event" withouth declaring the "splide" variable, just calling the .splide element, something like:
$("#MySplide").('moved', function() { // do something } );
I hope I have explained myself well and thanks in advance for the help! (:
Pretty close, just needed the .on before .('moved') in the second example!
new Splide( '#splide' ).mount().on( 'moved', function() {
// do something
} );
You can essentially collapse the variable and perform it all on "one line" (note: not really 1 line)
Close the issue due to the major version update. Feel free to create a new issue or open a new discussion.