Blame view

assets/js/pages/form-image-crop.js 782 Bytes
cf76164e6   Ting Chan   20190709
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
  $(document).ready(function(){
      
      var $image = $(".image-crop > img");
  
      $image.cropper({
          aspectRatio: "free",
          preview: ".img-preview"
      });
      
      $("#zoomIn").click(function() {
          $image.cropper('zoom', 0.1);
      });
  
      $("#zoomOut").click(function() {
          $image.cropper('zoom', -0.1);
      });
  
      $("#rotateLeft").click(function() {
          $image.cropper('rotate', 45);
      });
  
      $("#rotateRight").click(function() {
          $image.cropper('rotate', -45);
      });
      
      $("#clear").click(function() {
          $image.cropper('clear');
      });
      
      var $replaceWith = $('#replaceWith');
      $('#replace').click(function () {
        $image.cropper('replace', $replaceWith.val());
      });
      
  });