私はここにスロットマシンプラグインを持っています。これはULを回転させ、そのうちの1つをランダムに表示します。
表示されているULに値を設定してほしい。
このようなもの:
if ($("#1").is(":visible") == true) {
dial.setValue(8);
};
あなたが助けることができることを願っています。
ありがとう。
私はここにスロットマシンプラグインを持っています。これはULを回転させ、そのうちの1つをランダムに表示します。
表示されているULに値を設定してほしい。
このようなもの:
if ($("#1").is(":visible") == true) {
dial.setValue(8);
};
あなたが助けることができることを願っています。
ありがとう。
onEnd :function() { ... },
あなたがあなたの機能を必要とするところのようです
// Function: run on spin end. It is passed (finalNumbers:Array).
// finalNumbers gives the index of the li each slot stopped on in order.
アイテムが1つしかない理由はよくわかりませんが、機能するコードは次のとおりです。
onEnd: function(finalNumbers) {
if (finalNumbers[0]==1) dial.setValue(8); // found 1st li
}
onEndパラメーターに関数を追加します。関数に渡される変数は、スピナーの最終値です。
// --------------------------------------------------------------------- //
// DEFAULT OPTIONS
// --------------------------------------------------------------------- //
$.jSlots.defaultOptions = {
number : 1, // Number: number of slots
spinner : '', // CSS Selector: element to bind the start event to
spinEvent : 'click', // String: event to start slots on this event
onStart : $.noop, // Function: runs on spin start,
onEnd : function handleEnd($finalNumber){alert(finalNumber);}, // Function: run on spin end. It is passed (finalNumbers:Array). finalNumbers gives the index of the li each slot stopped on in order.
onWin : $.noop, // Function: run on winning number. It is passed (winCount:Number, winners:Array)
easing : 'swing', // String: easing type for final spin
time : 7000, // Number: total time of spin animation
loops : 6 // Number: times it will spin during the animation
};