-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
40 lines (32 loc) · 900 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
//global variables
var hTotal = 0,
rTotal = 0,
allRolls=[];
// $('#slider-0').bind( "keypress", function(e){ //nothing seemed to work to add events to the slider
$(document).keypress(function(e) {
if(e.which == 13 ) {rollDice()};
})
$('#clearButton').click(function () {
clear();
$('select').val('off').slider('refresh');
})
function clear() {
$('input').val('');
$('#slider-0').val($('#slider-0').attr('min')).slider('enable');
hTotal = 0;
rTotal = 0;
allRolls.length = 0;
}
$('#rollButton').click(function(){
rollDice();
})
$('#flip6').bind( "change", function () {
if($('#flip6').val()=='on')
$('#flipX').val('off').slider('refresh');
clear();
})
$('#flipX').bind( "change", function () {
if($('#flipX').val()=='on')
$('#flip6').val('off').slider('refresh');
clear();
})