简体   繁体   中英

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.

The image "duplicates" on the web page. (using a random image for example here)

My Html, Image:

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

My 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包含到文件中

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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