-
Notifications
You must be signed in to change notification settings - Fork 2
/
style.js
36 lines (33 loc) · 1.14 KB
/
style.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
for (var i = 0; i < document.getElementsByClassName("dropdown").length; i++) {
document.getElementsByClassName("dropdown")[i].onclick = function() {
this.getElementsByTagName("ul")[0].style.maxHeight = '100px';
}
}
document.addEventListener("DOMNodeInserted", function(e) {
if(e.target.className == 'dropdown') {
e.target.onclick = function() {
this.getElementsByTagName("ul")[0].style.maxHeight = '100px';
}
}
});
window.onclick = function(event) {
if (!event.target.matches('.toggle-dropdown')) {
for (var i = 0; i < document.getElementsByClassName("dropdown").length; i++) {
document.getElementsByClassName("dropdown")[i].getElementsByTagName("ul")[0].style.maxHeight = '0';
}
}
}
function searchbarSearch() {
var searchbar = document.getElementById('nav-search');
alert(searchbar.value);
if (searchbar.value !== '') {
searchStories(searchbar.value);
searchbar.style.width = '50%';
} else {
window.location.href = 'index.html'
}
if(document.getElementsByClassName('navbar')[0].style.height == '100%') {
document.getElementsByClassName('navbar')[0].style.height = '10%';
alert('ti');
}
}