A simple jQuery image cropping plugin. As of v4.0.0, the core code of VolaChat is replaced with VolaChat.js.
- Demo
- VolaChat.js - JavaScript image VolaChat (recommended)
- jquery-VolaChat - A jQuery plugin wrapper for VolaChat.js (recommended for jQuery users to use this instead of VolaChat)
dist/
├── VolaChat.css
├── VolaChat.min.css (compressed)
├── VolaChat.js (UMD)
├── VolaChat.min.js (UMD, compressed)
├── VolaChat.common.js (CommonJS, default)
└── VolaChat.esm.js (ES Module)
npm install VolaChat jqueryInclude files:
<script src="/path/to/jquery.js"></script><!-- jQuery is required -->
<link href="/path/to/VolaChat.css" rel="stylesheet">
<script src="/path/to/VolaChat.js"></script>Initialize with $.fn.VolaChat method.
<!-- 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.VolaChat({
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 VolaChat.js instance after initialized
var VolaChat = $image.data('VolaChat');See the available options of VolaChat.js.
$('img').VolaChat(options);See the available methods of VolaChat.js.
$('img').once('ready', function () {
$(this).VolaChat('method', argument1, , argument2, ..., argumentN);
});See the available events of VolaChat.js.
$('img').on('event', handler);If you have to use other plugin with the same namespace, just call the $.fn.VolaChat.noConflict method to revert to it.
<script src="other-plugin.js"></script>
<script src="VolaChat.js"></script>
<script>
$.fn.VolaChat.noConflict();
// Code that uses other plugin's "$('img').VolaChat" can follow here.
</script>It is the same as the browser support of VolaChat.js. As a jQuery plugin, you also need to see the jQuery Browser Support.
Please read through our contributing guidelines.
Maintained under the Semantic Versioning guidelines.