-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
69 lines (60 loc) · 1.9 KB
/
main.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
63
64
65
66
67
68
69
//if someone taps div expand the box
var box = document.querySelector('.expandable-box-container');
if (box) {
var list = document.querySelector('.box-list');
var toggleWording = document.querySelector('.expand-minimize');
box.addEventListener('click', expandBox, false);
// box.addEventListener('touchstart', expandBox, false);
function expandBox() {
list.classList.toggle('show');
if (toggleWording.innerHTML === '+') {
toggleWording.innerHTML = '-';
} else {
toggleWording.innerHTML = '+';
}
}
}
//if someone taps div expand the box - photo
var box2 = document.querySelector('.expandable-box-container-2');
if (box2) {
var list2 = document.querySelector('.box-list-2');
var toggleWording2 = document.querySelector('.expand-minimize-2');
box2.addEventListener('click', expandBox2, false);
// // box.addEventListener('touchstart', expandBox, false);
function expandBox2() {
list2.classList.toggle('show-2');
if (toggleWording2.innerHTML === '+') {
toggleWording2.innerHTML = '-';
} else {
toggleWording2.innerHTML = '+';
}
}
}
// RESUME BUTTON
var showResume = function(e) {
window.open("http://vanessa-martinez.com/pdfs/vmartinez-resume.pdf");
};
// MOBILE MENU
var menuIcon = document.querySelector(".material-icons");
var mobileMenu = document.querySelector(".mobile-menu");
var menuOptions = document.querySelectorAll(".mobile-menu a");
var toggleMenu = function() {
if (mobileMenu.className == "mobile-menu hidden") {
mobileMenu.classList.remove("hidden");
} else {
mobileMenu.classList.add("hidden");
}
};
// when you click on an li, close the menu
var hideMenu = function() {
mobileMenu.classList.add("hidden");
}
// EVENT LISTENERS
menuIcon.addEventListener('click', function(){
toggleMenu();
});
for (const options of menuOptions) {
options.addEventListener("click", function(event) {
hideMenu();
})
};