开发者

Jcrop check API presence

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 th开发者_StackOverflowere any way?

Thank you

Jerry2


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!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜