-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
57 lines (43 loc) · 1.69 KB
/
script.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
function vibrate(type) {
navigator.vibrate = navigator.vibrate || navigator.webkitVibrate || navigator.mozVibrate || navigator.msVibrate;
if (navigator.vibrate) {
if (type == 'throb') {
navigator.vibrate([500, 110, 500, 110, 450, 110, 200, 110, 170, 40, 450, 110, 200, 110, 170, 40, 500]);
} else if (type == 'shake') {
navigator.vibrate([125, 75, 125, 275, 200, 275, 125, 75, 125, 275, 200, 600, 200, 600]);
} else if (type == 'pulsate') {
navigator.vibrate([75, 75, 75, 75, 75, 75, 75, 75, 150, 150, 150, 450, 75, 75, 75, 75, 75, 525]);
} else if (type == 'vibrate') {
navigator.vibrate([150, 150, 150, 150, 75, 75, 150, 150, 150, 150, 450]);
} else if (type == 'phone-call') {
navigator.vibrate([1000, 500, 1000, 500, 1000, 500, 1000, 500, 1000, 500, 1000, 500, 1000, 500]);
} else if (type == '007') {
navigator.vibrate([200, 100, 200, 275, 425, 100, 200, 100, 200, 275, 425, 100, 75, 25, 75, 125, 75, 25, 75, 125, 100, 100]);
} else {
navigator.vibrate(50);
}
}
}
$(document).ready(function($) {
$('.button--normal').click(function() {
vibrate();
});
$('.button--phone-call').click(function() {
vibrate('phone-call');
});
$('.button--vibrate').click(function() {
vibrate('vibrate');
});
$('.button--shake').click(function() {
vibrate('shake');
});
$('.button--throb').click(function() {
vibrate('throb');
});
$('.button--pulsate').click(function() {
vibrate('pulsate');
});
$('.button--pulse').click(function() {
vibrate('pulse');
});
});