overlay and image loader wip
parent
c08b00b7bc
commit
e8afdfdfc8
@ -1,10 +1,16 @@
|
|||||||
document.querySelector('input[type="file"]').addEventListener("change", function () {
|
window.addEventListener("load", function () {
|
||||||
if (this.files && this.files[0]) {
|
let input = document.querySelector('input[type="file"]');
|
||||||
var img = document.querySelector("img");
|
input.addEventListener("change", function () {
|
||||||
img.onload = () => {
|
console.log(this.files);
|
||||||
URL.revokeObjectURL(img.src); // no longer needed, free memory
|
if (this.files && this.files[0]) {
|
||||||
};
|
let img = document.querySelector("img");
|
||||||
|
img.onload = () => {
|
||||||
|
img.classList.add("visible");
|
||||||
|
input.classList.add("hidden");
|
||||||
|
URL.revokeObjectURL(img.src); // no longer needed, free memory
|
||||||
|
};
|
||||||
|
|
||||||
img.src = URL.createObjectURL(this.files[0]); // set src to blob url
|
img.src = URL.createObjectURL(this.files[0]); // set src to blob url
|
||||||
}
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue