一个用于 Cropper.js 的 jQuery 插件包装器。
用于 Cropper.js 1.0 的 jQuery 插件包装器。
dist/
├── jquery-cropper.js (UMD)
├── jquery-cropper.min.js (UMD, compressed)
├── jquery-cropper.common.js (CommonJS, default)
└── jquery-cropper.esm.js (ES Module)npm install jquery-cropper jquery cropperjs@1包含文件:
使用 $.fn.cropper 方法进行初始化。
/* Limit image width to avoid overflow the container */
img {
max-width: 100%; /* This rule is very important, please do not ignore this! */
}var $image = $('#image');
$image.cropper({
aspectRatio: 16 / 9,
crop: function(event) {
console.log(event.detail.x);
console.log(event.detail.y);
console.log(event.detail.width);
console.log(event.detail.height);
console.log(event.detail.rotate);
console.log(event.detail.scaleX);
console.log(event.detail.scaleY);
}
});
// Get the Cropper.js instance after initialized
var cropper = $image.data('cropper');请参阅 Cropper.js 1.0 的可用 选项。
$().cropper(options);请参阅 Cropper.js 1.0 的可用 方法。
$().cropper('method', argument1, , argument2, ..., argumentN);请查看 Cropper.js 1.0 的可用 事件。
$().on('event', handler);如果您必须使用具有相同命名空间的其他插件,只需调用 $.fn.cropper.noConflict 方法即可恢复到原有状态。
暂无开放 Issues,或尚未同步最近议题。