Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cropit Cannot read property 'push' of undefined #310

Open
nargessmi87 opened this issue Apr 28, 2021 · 1 comment
Open

cropit Cannot read property 'push' of undefined #310

nargessmi87 opened this issue Apr 28, 2021 · 1 comment

Comments

@nargessmi87
Copy link

I get this error :

Uncaught TypeError: Cannot read property 'push' of undefined
at Cropit.init (jquery.cropit.js:274)
at new Cropit (jquery.cropit.js:194)
at HTMLDivElement. (jquery.cropit.js:102)
at Function.each (app.js?id=79f598946b8ba4ad1fb4:15693)
at jQuery.fn.init.each (app.js?id=79f598946b8ba4ad1fb4:15515)
at jQuery.fn.init.init (jquery.cropit.js:96)
at jQuery.fn.init._jquery2.default.fn.cropit (jquery.cropit.js:147)
at HTMLDocument. (app.js?id=79f598946b8ba4ad1fb4:10447)
at mightThrow (app.js?id=79f598946b8ba4ad1fb4:19074)
at process (app.js?id=79f598946b8ba4ad1fb4:19142)

here is the script:

$('.image-editor').cropit({
  imageState: {
    src: 'http://lorempixel.com/500/400/',
  },
});

$('.rotate-cw').click(function() {
  $('.image-editor').cropit('rotateCW');
});
$('.rotate-ccw').click(function() {
  $('.image-editor').cropit('rotateCCW');
});

$('.export').click(function() {
  var imageData = $('.image-editor').cropit('export');
  window.open(imageData);
});

and the html:

Resize image
Rotate counterclockwise Rotate clockwise
        <button class="export">Export</button>
        </div>
    </div>

how can i fix this

@SebastienGautier
Copy link

You're probably using jQuery 3+
Cropit seems to be compatible with jQuery 2 only

Adding jQuery Migrate should fix your issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants