I want to use Jcrop in .dialog()
, but it is not working correctly, Jcrop selection is getting wrong, distorting the image:
Insteadofdoingso:
The js looks like this:
$('.imagem_principal').live('click', function() {
var foto = $(this).parent().parent().find('a').attr('href');
var form = '<div id="box-crop"><img src="'+foto+'" id="foto-crop"></div>';
$(form).dialog({
open: function(event, ui) {
$("#foto-crop").Jcrop({
setSelect: [0, 0, 140, 360],
minSize: [140, 360],
aspectRatio: 1
});
},
autoOpen: true,
width: 800,
height: 600,
title: "Corte imagem principal",
buttons: {
"Cortar foto": function() {
$( this ).dialog( "close" );
},
"Cancelar": function() {
$( this ).dialog( "close" );
}
}
});
});