Question

I am having problems with Jcrop API. I don't think I need to go into detail as why I need this check, but I need to check if the Jcrop API is present so I can destroy it or not create another one if it is already created. Is there a way to check if api is present? Maybe this is Jquery or javascript check, I am quite a beginner. In the Jcrop documentation I found out only how to crate api and destroy it, not how to check if it exists.

Is there any way?

Thank you

Jerry2

Was it helpful?

Solution

I do it like this.

First grab the API object:

jcrop_object = $('#image_to_crop').data('Jcrop');

Anywhere else in your code you want to check for its existence, just null-check it:

if (jcrop_object == null) {
   super secret destroy/recreate code for JCrop API object
}

I am also having issues with this API, but for different reasons it seems :)

Best of luck!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top