javascript - Edit image on browse -
i have code when click on edit icon adds new image below existing image. want new image replace existing image.
i know have use index attribute in div, need in doing so. adding code here:
addimage = function(event){ var parent = event.currenttarget.parentnode.parentnode.parentnode, index = parseint(parent.getattribute('index')), script, clone = imageview.clonenode(true), files = event.target.files; (var = 0, f; f = files[i]; i++) { // process image files. if (!f.type.match('image.*')) { continue; } var reader = new filereader(); // closure capture file information. var imagebot = clone.queryselector('[name=imagebot]'); if (imagebot) imagebot.innerhtml = '<svg style="position:absolute; top:45%;left:50%" class="spinner" width="25px" height="25px" viewbox="0 0 66 66" xmlns="http://www.w3.org/2000/svg">' + '<circle class="path" fill="none" stroke-width="6" stroke-linecap="round" cx="33" cy="33" r="30"></circle>' + '</svg>'; clone.queryselector('.welcome-pane-user-content').setattribute('data-type', 'image'); setviewbyindex(index, clone.children[0]); document.queryselector('[name=insertoverlayview]').classlist.add('hide'); reader.readasdataurl(f); } };
this in plain javascript. no jquery please.
Comments
Post a Comment