I know that this is the way to the publication date, but I wanted to publish this solution for everyone who came across this post.
You can fire the event by doing something line by line:
//TO DEFINE SLIDER AND EVENTS $('#slider').slider().bind('slidechange',function(event,ui){...}); //TO TRIGGER EVENT $('#slider').trigger('slidechange');
Unfortunately, you cannot define functions as parameters inside an init object, however, I think it ends up looking cleaner and more direct and correct than another answer using a call method (i.e. it uses an event system).
And yes, the callbacks that you define here will be called during normal operation (in this case, changing the position of the slider), as usual. Just make sure you use the correct event type names from the user interface documentation.
If you want to add several events at once, remember that you can provide an object for binding using event names as keys:
//TO DEFINE SLIDER AND EVENTS $('#slider').slider().bind({ slidestart : function(event,ui) {...}, slidechange : function(event,ui) {...}, slidestop : function(event,ui) {...}, }); //TO TRIGGER EVENTS $('#slider').trigger('slidestart'); $('#slider').trigger('slidechange'); $('#slider').trigger('slidestop');
This is noted in the documentation, though, this is not very clear. He asked me to develop a couple of plugins myself, in order to really understand the user interface event system.
Enjoy
Joey Yore Jul 05 2018-11-11T00: 00Z
source share