在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:fengyuanchen/jquery-cropper开源软件地址:https://github.com/fengyuanchen/jquery-cropper开源编程语言:JavaScript 100.0%开源软件介绍:jquery-cropper
Main
Getting startedInstallationnpm install jquery-cropper jquery cropperjs Include files: <script src="/path/to/jquery.js"></script><!-- jQuery is required -->
<script src="/path/to/cropper.js"></script><!-- Cropper.js is required -->
<link href="/path/to/cropper.css" rel="stylesheet">
<script src="/path/to/jquery-cropper.js"></script> UsageInitialize with <!-- Wrap the image or canvas element with a block element (container) -->
<div>
<img id="image" src="picture.jpg">
</div> /* 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'); OptionsSee the available options of Cropper.js. $().cropper(options); MethodsSee the available methods of Cropper.js. $().cropper('method', argument1, , argument2, ..., argumentN); EventsSee the available events of Cropper.js. $().on('event', handler); No conflictIf you have to use other plugin with the same namespace, just call the <script src="other-plugin.js"></script>
<script src="jquery-cropper.js"></script>
<script>
$.fn.cropper.noConflict();
// Code that uses other plugin's "$().cropper" can follow here.
</script> Browser supportIt is the same as the browser support of Cropper.js. As a jQuery plugin, you also need to see the jQuery Browser Support. ContributingPlease read through our contributing guidelines. VersioningMaintained under the Semantic Versioning guidelines. License |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论