jQuery-jSlots
jQuery-jSlots copied to clipboard
How to Set END NUMBERS Solved
Hi Firs thanks for this awesome jslot. I used it in mvc project i am completely newbie to programing and some how make it work for 0-10 numbers. if any one have issue about this you can see my code if it can be any help
<div class="container">
<div class="row">
<div id="WinScroll" class="text-center">
<div class="fancy">
<ul class="slot">
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
<li>5</li>
<li>6</li>
<li>7</li>
<li>8</li>
<li>9</li>
<li>0</li>
</ul>
<input type="button" value="test" id="playBtn" />
</div>
</div>
</div>
</div>
END Numbers are coming from variable winnerNumber which i get from @Model in MVC There was a problem it wont get data directly from variable which is coming from database you have to explicitly give the value.
var myArray = [];
@foreach (var d in Model)
{
@:myArray.push("@d");
}
Data get into Array Then
for (i = 0; i < myArray.length; i++) {
var tim_win= myArray[i];
}
i get data from model and save it in variable and then but the END NUMBER wont get it so i have to get the value from variable and then compare then value in IF Else and get him the direct variable like w1 =3 so the END Number can get this value directly not the value directly coming from data base but the value which is equal to the database here is example how i done it i get the data base value in win and there are three numbers in it so separate them in three Ints
var winS = win;
// in my case only three integers are coming from data base like 123
var First = parseInt(winS[0]); //get first character
var Second = parseInt(winS[1]); //get Second character
var Third = parseInt(winS[2]); //get Thirdcharacter
and then get the vale in First you have to explicitly give the value to w1 END NUMBER
if (First == 0) { w1 = 10; }
else if (First == 1) { w1 = 1; }
else if (First == 2) { w1 = 2; }
else if (First == 3) { w1 = 3; }
else if (First == 4) { w1 = 4; }
else if (First == 5) { w1 = 5; }
else if (First == 6) { w1 = 6; }
else if (First == 7) { w1 = 7; }
else if (First == 8) { w1 = 8; }
else if (First == 9) { w1 = 9; }
Do this also for the second value and third value which is in this case w2 and w3 now send this w1,w2,w3 value to the END NUMBERS
$(document).ready(function () {
$('.slot').jSlots({
spinner: '#playBtn',
endNumbers: [w1 , w2 , w3] //<----- Added endNumbers option
});
});
Its done.I Hope it helps i am newbie so cant explain it well