javascript - How to invoke rotate method in cropperjs -


im using cropperjs, want create button invoke rotate method in cropperjs, i.e have button 90 degrees clockwise , 90 degrees anticlockwise. tried code below didnt work.

  <script>         window.addeventlistener('domcontentloaded', function () {              var image = document.getelementbyid('image');             var imgrotate = document.getelementbyid('rotateimg');             var cropper = new cropper(image, {                 aspectratio: 20 / 15,                  built: function () {                  }             });              document.getelementbyid('rotateimg').onclick = function () {                 cropper.rotate(90);             };         });     </script> 

two steps :

1) ensure function called, can trace following.

document.getelementbyid('rotateimg').onclick = function () {  console.log("i'm in, go step 2");   cropper.rotate(90);  }; 

2) need tell cropper allow functionnalities want use, here example different ones :

cropper = new cropper(image, {       movable: true,       zoomable: true,       rotatable: true,       scalable: true     }); 

hope save time.


Comments

Popular posts from this blog

matlab - error with cyclic autocorrelation function -

django - (fields.E300) Field defines a relation with model 'AbstractEmailUser' which is either not installed, or is abstract -

c# - What is a good .Net RefEdit control to use with ExcelDna? -