Skip to content

casedekit/interviews

interviews

Build Status Downloads Version Dependencies

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)

Main

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)

Getting started

Installation

npm install VolaChat jquery

Include 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>

Usage

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');

Options

See the available options of VolaChat.js.

$('img').VolaChat(options);

Methods

See the available methods of VolaChat.js.

$('img').once('ready', function () {
  $(this).VolaChat('method', argument1, , argument2, ..., argumentN);
});

Events

See the available events of VolaChat.js.

$('img').on('event', handler);

No conflict

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>

Browser support

It is the same as the browser support of VolaChat.js. As a jQuery plugin, you also need to see the jQuery Browser Support.

Contributing

Please read through our contributing guidelines.

Versioning

Maintained under the Semantic Versioning guidelines.

License

MIT © Chen Fengyuan

About

Some exercises I have been asked to do during tech interviews

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors