Try:
$('#preview').attr('src', response).Jcrop({}, function() {
$('.box').center();
});
Question
I'm having trouble with the JCrop plugin.
I have this little code:
$('#preview').attr('src', response).Jcrop();
$('.box').center();
response is an string that contains the img path.
My #preview is inside a .box element, and dynamically updated by JCrop.
The problem is, after the Jcrop(), the .box isn't center (center() function center the element in window).
If, in javascript console on browser I put the $('.box').center(); and press enter, the element is centered, normally.
Why this problem?
Is very difficult to create a fiddler for this, because the complexity of the code to simulate an dynamically image insert.
Thanks for the support already.
La solution
Try:
$('#preview').attr('src', response).Jcrop({}, function() {
$('.box').center();
});