-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
57 lines (45 loc) · 1.93 KB
/
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
window.onload = () => {
let panelBlock = document.querySelector('.nav__Panel');
let panelImage = document.querySelector('.nav__PanelImage');
panelImage.addEventListener('click', (e) => {
panelBlock.classList.toggle('nav__Panel_hidden');
e.stopImmediatePropagation();
});
panelBlock.addEventListener('click', (e) => {
e.stopImmediatePropagation();
}, true);
let body = document.querySelector('.body');
body.addEventListener('click', (e) => {
if (!panelBlock.classList.contains('nav__Panel_hidden')) {
panelBlock.classList.add('nav__Panel_hidden');
}
});
let timeID;
$('.main__submitsButton_b').hover(function() {
let sizeObj = [142, 147, 167, 150, 145, 145, 153, 162, 142, 149, 145];
let pos, wid;
do {
let num = Math.floor((Math.random() * 11));
wid = sizeObj[num];
pos = -36 * num;
}
while (pos == -180);
timeID = setTimeout(function() {
$('.main__submitsButton_b').animate({
'width': wid + 'px'
}, 400);
$('.main__submitsButtonList').animate({
'top': pos + 'px'
}, 400);
}, 200);
},
function() {
clearTimeout(timeID);
$('.main__submitsButton_b').animate({
'width': 143 + 'px'
}, 200);
$('.main__submitsButtonList').animate({
'top': -180 + 'px'
}, 200);
});
};