Search code examples
jqueryjcrop

Unbind jCrop without hiding the image


I made an image editor that lets you optionally crop the image you're working with (using Jcrop).

$('#canvas img').Jcrop({
    bgColor: 'black',
    bgOpacity: .4
}, function () {
    jcrop_api = this;
});

For this reason, I need to bind and unbind Jcrop at will, however I have noticed that when I call

jcrop_api.destroy()

it hides the image that Jcrop was bound to as well. Am I using it the correct way? Is there a way around this?


Solution

  • SOLUTION

    I have since discovered that this is not possible. However, what you can do is this:

    Once you have initialized jCrop, use the following to clear the selection and stop the image being 'selectable' any longer:

        jcrop_api.release();
        jcrop_api.disable();
    

    And then enable it again using:

        jcrop_api.enable();