Search code examples
javascriptjqueryjcrop

Disabling JCrop on document load


I'm trying to disable the JCrop functionality on document load. I tried placing a disable() function in my document.ready function, but it seems it does not disable JCrop.

My Syntax is:

$(document).ready(function(){

jcrop_api.disable();

});

How do I disable the JCrop on document load, and if ever I want to enable it again, how would I do it?


Solution

  • Try this

    var jcrop_api;
    function initJcrop() {
        jcrop_api = $.Jcrop('#cropbox');
    }
    //destroy JCrop
    function destroyJCrop(){
       jcrop_api.destroy();
    }
    //rehook JCrop
    function hookJCrop(){
        initJcrop();
    }
    

    Documentation: http://deepliquid.com/projects/Jcrop/demos.php?demo=advanced