-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshared.js
More file actions
67 lines (58 loc) · 1.98 KB
/
shared.js
File metadata and controls
67 lines (58 loc) · 1.98 KB
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
63
64
65
66
67
var backdrop = document.querySelector('.backdrop');
var modal = document.querySelector('.modal');
var selectPlanButtons = document.querySelectorAll('.plan button');
var modalNegativeButton = document.querySelector('.modal__action--negative');
var toggleButton = document.querySelector('.toggle-button');
var mobileNav = document.querySelector('.mobile-nav');
var ctaButton = document.querySelector('.main-nav__item--cta');
for (var i = 0; i < selectPlanButtons.length; i++) {
selectPlanButtons[i].addEventListener('click', function () {
modal.classList.add('open');
backdrop.style.display = 'block';
setTimeout(function () {
backdrop.classList.add('open');
}, 10);
});
}
backdrop.addEventListener('click', function () {
mobileNav.classList.remove('open');
closeModal();
});
if (modalNegativeButton) {
modalNegativeButton.addEventListener('click', function () {
mobileNav.classList.remove('open');
backdrop.classList.remove('open');
modal.classList.remove('open');
});
}
toggleButton.addEventListener('click', function () {
mobileNav.classList.add('open');
backdrop.style.display = 'block';
setTimeout(function () {
backdrop.classList.add('open');
}, 10);
});
function showModal(targetModal) {
// backdrop.style.display = 'block';
// targetModal.style.display = 'block';
modal.classList.remove('open');
backdrop.classList.remove('open');
}
function closeModal() {
if (modal) {
modal.classList.remove('open');
}
backdrop.classList.remove('open');
setTimeout(function () {
backdrop.style.display = 'none';
}, 200);
}
ctaButton.addEventListener('animationstart', function (event) {
console.log('Animation started', event);
});
ctaButton.addEventListener('animationend', function (event) {
console.log('Animation ended', event);
});
ctaButton.addEventListener('animationiteration', function (event) {
console.log('Animation iteration', event);
});