js图片剪裁工具cropper使用问题

这是cropper的演示页面:https://fengyuanchen.github.i...

我想使用旋转按钮,就是下面红框中的两个:

https://img3.mukewang.com/5bd2b03900012d0507780140.jpg

按照文档操作https://github.com/fengyuanch...

<div class="btn-group" role="group" aria-label="Basic example">

   <button id="rotateLeft" type="button" class="btn btn-secondary" data-method="rotate" data-option="-90" title="左转">

       <i class="fa fa-undo" aria-hidden="true">左转90度</i>

   </button>

   <button id="rotateRight" type="button" class="btn btn-secondary" data-method="rotate" data-option="90" title="右转">

       <i class="fa fa-repeat" aria-hidden="true">右转90度</i>

   </button>

</div>

$("#rotateLeft").cropper('rotate', -90);
$("#rotateRight").cropper('rotate', 90);

可是不能使用,浏览器提示Cannot read property 'rotate' of undefined

https://img3.mukewang.com/5bd2b05000011bcb05230150.jpg

看了一下js源代码: https://fengyuanchen.github.i... 
没看懂是怎么触发按钮的,请大神帮讲一下过程。

慕标琳琳
浏览 1152回答 1
1回答
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript