-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscriptDashboard.js
More file actions
41 lines (35 loc) · 1.1 KB
/
scriptDashboard.js
File metadata and controls
41 lines (35 loc) · 1.1 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
const newfir=document.getElementById('newfirbutton');
const profile=document.getElementById('profile');
const dropdown=document.getElementById('dropdown');
const para=profile.firstElementChild;
const width=profile.offsetLeft-130;
const height=profile.offsetTop+60;
dropdown.style.left=width+'px';
dropdown.style.top=height+'px';
newfir.addEventListener('click',()=>{
window.location.href='form.html';
});
window.addEventListener('resize', () => {
// const width_bar=searchandprofile.clientWidth;
// const width=(window.innerWidth-width_bar)/2-130;
const width=profile.offsetLeft-130;
const height=profile.offsetTop+60;
dropdown.style.left=width+'px';
dropdown.style.top=height+'px';
});
profile.addEventListener('click',()=>{
if(dropdown.style.display==='none'){
dropdown.style.display='flex';
}
else{
dropdown.style.display='none';
}
});
profile.addEventListener('blur',()=>{
dropdown.style.display='none';
});
window.addEventListener('click',(event)=>{
if(event.target!==profile && event.target!==para ){
dropdown.style.display='none';
}
});