-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.js
More file actions
19 lines (16 loc) · 706 Bytes
/
Copy pathmain.js
File metadata and controls
19 lines (16 loc) · 706 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import html2canvas from "./node_modules/html2canvas/dist/html2canvas.esm.js";
// parameterized function takeImage to make it more reusable
export function takeImg(elem, wrapper=document.body){
console.log("trying to take image");
html2canvas(elem).then(canvas => {
wrapper.innerHTML = null
wrapper.appendChild(canvas)
console.log(screenshotWrapper);
})
}
// redifined image to globalscope
const image = document.querySelector('.quoteDiv');
const cammera = document.querySelector("#camera");
const screenshotWrapper = document.querySelector("#screenshot");
// adding a click event to camera
cammera.addEventListener("click", () => takeImg(image, screenshotWrapper));