forked from almendro/10-seconds-math
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.js
62 lines (49 loc) · 1.23 KB
/
setup.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
"use strict";
// set background height according to screen size
$(function() {
var footerHeight = 55;
if (isMobile()) {
footerHeight = 35;
}
var padd = $(window).height() - $('body').height() - footerHeight;
$('#questionbox').css({'padding-bottom': padd + 'px'});
});
// On document ready, initialize noUiSlider.
$(function(){
var formatToolTipContent = function(value) {
return '<span>' + Math.floor(value) + '</span>';
}
var createRangeToolTip = function() {
return $.Link({
target: '-tooltip-<div class="tooltip"></div>',
method: function ( value ) {
// The tooltip HTML is 'this', so additional
// markup can be inserted here.
$(this).html(formatToolTipContent(value));
}
});
}
var toolTipLowerBound = createRangeToolTip();
$('#math-range-slider').noUiSlider({
range: {
'min': [ 10 ],
'90%': [ 100 ],
'max': [ 1000 ]
},
start: 30,
step: 10,
connect: 'lower',
serialization: {
lower: [ toolTipLowerBound ]
}
});
if (!isMobile()) {
$('#math-range-slider').change(function() {
$('#question-answer').focus();
});
}
});
// enable tooltips
$(function() {
$("[data-toggle=tooltip]").tooltip();
});