我正在使用 javascript cropperjs裁剪用户上传的图像。在裁剪器显示中,裁剪框外部的图像不可见。下图所示的示例 -
我的裁剪机配置是 -
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/