$(document).ready(function(){ var list = [ 4, 2 , 1, 3 ] var index = 0 var machine = $("#machine4").slotMachine({ active : 0, delay : 500, randomize : function(activeElementIndex){ return list[index]; } }); $("#slotMachineButtonShuffle").click(function(){ machine.shuffle(); $("#slotMachineButtonShuffle").addClass("xxx"); setTimeout(() => { index ++ machine.stop(); $("#slotMachineButtonShuffle").removeClass("xxx"); }, 1000); }); // $("#slotMachineButtonStop").click(function(){ // }); });