I am having problem with my below code, I have Wheels of fortune. but, I want only one spin.
this code
Thanks for help
// Process
box.style.setProperty("transition", "all ease 5s");
box.style.transform = "rotate(" + Hasil[0] + "deg)";
element.classList.remove("animate");
setTimeout(function () {
element.classList.add("animate");
}, 5000);
// ALert
setTimeout(function () {
applause.play();
swal(
"Congratulations",
"You Won The " + SelectedItem + ".",
"success"
).then(function(){
// window.location.href= "submit.php?id=($id)";
});
}, 5500)
// Delay and set to normal state
setTimeout(function () {
box.style.setProperty("transition", "initial");
box.style.transform = "rotate(90deg)";
}, 6000);
2
Answers
thanks @manday8055 solved that problem
To limit wheel spin to 1, keep a track of it using a
boolean
flag which checks whether the wheel has already spun or not. So say the callback that triggers afterclick
event is fired isspinWheel()
.