<script>
var nb = 10;
var currentPos = 0;
- var spinning=false;
+ var spinning = false;
$(function () {
var index = 0;
updateCurrentPos()
});
$("#spin").on('click', function () {
- if(spinning){
+ if (spinning) {
return;
}
- spinning=true;
+ spinning = true;
$("#results img").removeClass('visible');
currentPos = normIdx(currentPos);
var newpos = nb + (currentPos + Math.ceil(Math.random() * 9));
+ setTimeout(function () {
+ var pos = normIdx(newpos);
+ $("#i" + pos).addClass('visible');
+ }, 3000);
TweenLite.to(window, 6, {
currentPos: newpos,
ease: Power4.easeOut,
onUpdate: updateCurrentPos,
onComplete: endSpin
});
+
});
});
function endSpin() {
- spinning=false;
+ spinning = false;
currentPos = normIdx(currentPos);
- $("#i" + currentPos).addClass('visible');
}
function updateCurrentPos() {