简体   繁体   English

在cropper.js中遇到麻烦

[英]Having trouble with cropper.js

I am using cropper.js on something I am working on, but having a little trouble getting it to work properly, is it possible to see what I might be doing wrong. 我在正在处理的事情上使用cropper.js ,但是在使其正常工作时遇到一些麻烦,是否有可能看到我做错了什么。

The image "duplicates" on the web page. 该图像在网页上“重复”。 (using a random image for example here) (例如,在此处使用随机图片)

My Html, Image: 我的HTML图片:

<img id="ImageFrame" src="http://www.availstaffing.com/wp-content/uploads/2010/07/Temporary-Button.jpg" style="max-width:100%" />

My javascript: 我的JavaScript:

$(function () {
                var image = $('#ImageFrame');
                var cropImage = new Cropper(image[0], {
                    preview: 'div#CropPreview',
                    built: function () {},
                    crop: function (e) {
                        $("#cropX").val(Math.round(e.detail.x).toString());
                        $("#cropY").val(Math.round(e.detail.y).toString());
                        $("#cropH").val(Math.round(e.detail.height).toString());
                        $("#cropW").val(Math.round(e.detail.width).toString());
                    }
                });
            });

Then the result: 然后结果: 裁剪器渲染时图像正在复制

Any help would be welcome. 任何帮助都将受到欢迎。

尝试将cropper.css包含到文件中

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM