1 | document.addEventListener('DOMContentLoaded', function(){ |
||
2 | //Get Modal |
||
3 | var modal = document.getElementById('vd-modal'); |
||
4 | |||
5 | //Get button that opens modal |
||
6 | var btn_detail = document.getElementById('btn-detail'); |
||
7 | |||
8 | //get close span |
||
9 | var span_close = document.getElementsByClassName("close")[0]; |
||
10 | |||
11 | |||
12 | // btn_detail onclick event |
||
13 | btn_detail.onclick = function(){ |
||
14 | modal.style.display = "block"; |
||
15 | } |
||
16 | |||
17 | |||
18 | // span_close onclick event |
||
19 | span_close.onclick = function(){ |
||
20 | modal.style.display = "none"; |
||
21 | } |
||
22 | |||
23 | |||
24 | //close when user clicks anywhere outside the modal |
||
25 | window.onclick = function(){ |
||
26 | if(event.target == modal){ |
||
0 ignored issues
–
show
|
|||
27 | modal.style.display = "none"; |
||
28 | } |
||
29 | } |
||
30 | }, false); |
||
31 |
This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.
To learn more about declaring variables in Javascript, see the MDN.