0

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?

marchemike
  • 3,179
  • 13
  • 53
  • 96

2 Answers2

1

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

naveen
  • 53,448
  • 46
  • 161
  • 251
0

Try $(window).load(function() {

$(window).load(function() {
   jcrop_api.disable();
});

or

$(window).load(function() {
    jcrop_api.destroy();
});

destroy() Remove Jcrop entirely

crop can also be completely removed from the image


The ready event occurs after the HTML document has been loaded, while the onload event occurs later, when all content (e.g. images) also has been loaded.


Reference

Jcrop_API

Read window.onload vs $(document).ready()

Community
  • 1
  • 1
Tushar Gupta - curioustushar
  • 58,085
  • 24
  • 103
  • 107