Resizable does not work in dynamic image

0

I have a tool that when the user sends any image the resizable function does not work, unlike the static image that is already in the site.

I designed my question online, at the following link: link

If you have an alternative using jQuery , it would be good.

function doClick() {
  var el = document.getElementById("fileElem");
  if (el) {
    el.click();
  }
}

function handleFiles(files) {
    // onchange do formulário
    var d = document.getElementById("draggable");       
    var list = document.createElement("ul");        
    d.appendChild(list);
    for (var i=0; i < files.length; i++) {
        var li = document.createElement("li");
        list.appendChild(li);                       
        var img = document.createElement("img");
        img.width = 100;
        img.classList.add("ui-widget-content");
        img.classList.add("resizable");
        img.classList.add("ui-resizable");  
        img.src = window.URL.createObjectURL(files[i]);
        img.onload = function() {
            window.URL.revokeObjectURL(this.src);
        }
        li.appendChild(img);
    }
}
$(function() {
  // Redimensionameto que só está funcionando na imagem estática
    $( ".resizable" ).resizable({
        maxHeight: 194,
        maxWidth: 150,
        minHeight: 95,
        minWidth: 70
    });
});
                               
asked by anonymous 27.04.2014 / 21:00

1 answer

0

Try to run .resizable () after loading the image.

    
08.05.2014 / 16:38