javascript - CropperJS : Image outsite the crop box is not visible

标签 javascript cropper

我正在使用 javascript cropperjs裁剪用户上传的图像。在裁剪器显示中,裁剪框外部的图像不可见。下图所示的示例 -

enter image description here

我的裁剪机配置是 -

var cropper_opts = {
  aspectRatio: 1/1,
  viewMode: 0,
  crop: function(e){}, //to show the crop box manually
  minCanvasWidth: 0,
  minCanvasHeight: 0,
  minCropBoxWidth: 0,
  minCropBoxHeight: 0,
  minContainerWidth: 860,   //decides the size of image
  minContainerHeight: 355,  //decides the size of image
  autoCropArea: 1,
  modal: true,      // Show the black modal
  guides: true,     // Show the dashed lines for guiding
  center: true,     // Show the center indicator for guiding
  highlight: true,  // Show the white modal to highlight the crop box
  background: true, // Show the grid background
}

请帮我解决这个问题。

最佳答案

发生这种情况可能是因为您在某种已经集成了cropper的html模板中使用cropper,并且canvas元素已经应用了一些其他样式。

检查这个类.cropper-canvas

就我而言,我发现我使用的模板将其不透明度设置为 0。

.cropper-canvas {
  cursor: crosshair;
  background-color: #fff;
  opacity: 0; /* that's the problem */
  filter: alpha(opacity=0);
}

关于javascript - CropperJS : Image outsite the crop box is not visible,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39900677/

相关文章:

javascript - ko.toJS 将数组转换为对象

javascript - 如何更改容器 div 的高度以适合所有动态内容?

javascript - 这会导致浏览器内存泄漏吗?

angular - 如何通过 angular-cli 将 Cropper.js 用于 Angular2 项目?

javascript - 如何使用cropper.js对图像进行裁剪?

javascript - 如何使用 Javascript Cropper 修复发布到服务器的图像大小

javascript - 使 fengyuanchen 裁剪器响应式

javascript - 使用ajax提交时忽略表单验证

javascript - JQuery位置选择器,如何设置距起点的最大允许距离

javascript - 未捕获的 TypeError : $(. ..).cropper 不是函数 - Cropper.js