-
Notifications
You must be signed in to change notification settings - Fork 11
/
main.js
60 lines (53 loc) · 1.81 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
var loadFile = (event) => {
let image = document.getElementById('photo');
image.src = URL.createObjectURL(event.target.files[0]);
};
var loadName = (event) => {
let name = document.getElementById("name");
name.innerHTML = event.target.value;
}
const downloadImg = () =>{
var card = document.getElementById("card");
var val = document.getElementById("name").innerHTML;
html2canvas(card,{
scale:1.1,
backgroundColor:"rgba(0,0,0,0)"
}).then(function(canvas) {
var imgLink = document.createElement("a");
document.body.appendChild(imgLink);
imgLink.download = `${val}.png`;
imgLink.href = canvas.toDataURL("image/png");
imgLink.target = '_blank';
imgLink.click();
});
}
function onNavButtonClick() {
let navBar = document.getElementById("navbarSupportedContent");
let button = document.getElementById('navbar-custom-button');
let arial = button.getAttribute("aria-expanded");
navBar.classList.replace('collapse', 'collapsing');
if (navBar.classList.contains('show')){
button.classList.add('collapsed')
arial=false;
navBar.classList.remove('show');
} else {
button.classList.remove('collapsed')
arial=true;
navBar.classList.add('show');
}
button.setAttribute("aria-expanded", arial);
setTimeout(() => {
navBar.classList.replace('collapsing','collapse');
}, 95);
}
function onDropDownActivate() {
let dropdown = document.getElementById("navbarLightDropdownMenuLink");
let ul = document.getElementById('ulLightDropDown');
if (dropdown.classList.contains('show')){
ul.classList.remove('show');
dropdown.classList.remove('show');
} else {
ul.classList.add('show');
dropdown.classList.add('show');
}
}