diff --git a/index.html b/index.html index d356a28..f3abb72 100644 --- a/index.html +++ b/index.html @@ -5,42 +5,7 @@ - + -
+
diff --git a/index.js b/index.js new file mode 100644 index 0000000..15b9c5c --- /dev/null +++ b/index.js @@ -0,0 +1,38 @@ + +var crops = []; + +function makeCroppieElem(elem, imgUrl) { + cpie = new Croppie(elem, { + viewport: { + width: elem.clientWidth, + height: elem.clientHeight, + type: 'square' + }, + showZoomer: false, + }); + + cpie.bind({ + url: imgUrl + }); + + crops.push(cpie) +} + +function makeCroppie(collageDivId) { + const collageDiv = document.getElementById(collageDivId) + for(elem of collageDiv.getElementsByClassName("collage-img")) { + makeCroppieElem(elem, elem.dataset.collageImageUrl) + } +} + +function main() { + makeCroppie("collage") +} + +function showCrop() { + for(cpie of crops) { + console.log(cpie.get()) + console.log(cpie.element.clientWidth) + console.log(cpie.element.clientHeight) + } +}