WSlot
jQuery plugin to create a slot rolling list. Touch screen supported.
How to use
Create an element (div). The element must have a fixed width & height and CSS position is relative.
<div class="container" style="width:200px;height:200px;margin:0 auto;"></div>
<button id="get">get index</button>
<button id="getText">get text</button>
<button id="random">random</button>
Initialize WSlot on the element
$('.container').WSlot({
items:['one','two','three','four','five','six','seven','eight','nine','ten'],
center : 'first',
distance : 50,
displayed_length : 2,
angle : 30,
rotation : 0,
item_height : 20,
}).on('WSlot.change',function(e,index){
console.log(index);
});
$('#get').on('click',function(){
alert($('.container').WSlot('get'));
});
$('#getText').on('click',function(){
alert($('.container').WSlot('getText'));
});
$('#random').on('click',function(){
var rand = Math.floor(Math.random() * 9));
$('.container').WSlot('rollTo',rand);
});
Result
Option defaults
$('.someelement').WSlot({
items : [],
center : 'first',
distance : 'auto',
displayed_length : 2,
angle : 30,
rotation : 0,
item_height : 20,
});
Examples
iOS style date picker