cropper

WebJar for cropper

Лицензия

Лицензия

MIT
Группа

Группа

org.webjars.npm
Идентификатор

Идентификатор

cropper
Последняя версия

Последняя версия

4.0.0
Дата

Дата

Тип

Тип

jar
Описание

Описание

cropper
WebJar for cropper
Ссылка на сайт

Ссылка на сайт

http://webjars.org
Система контроля версий

Система контроля версий

https://github.com/fengyuanchen/cropper

Скачать cropper

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/org.webjars.npm/cropper/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>cropper</artifactId>
    <version>4.0.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/cropper/
implementation 'org.webjars.npm:cropper:4.0.0'
// https://jarcasting.com/artifacts/org.webjars.npm/cropper/
implementation ("org.webjars.npm:cropper:4.0.0")
'org.webjars.npm:cropper:jar:4.0.0'
<dependency org="org.webjars.npm" name="cropper" rev="4.0.0">
  <artifact name="cropper" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='cropper', version='4.0.0')
)
libraryDependencies += "org.webjars.npm" % "cropper" % "4.0.0"
[org.webjars.npm/cropper "4.0.0"]

Зависимости

compile (1)

Идентификатор библиотеки Тип Версия
org.webjars.npm : cropperjs jar [1.3.4,2)

Модули Проекта

Данный проект не имеет модулей.

Cropper

Build Status Downloads Version Dependencies

A simple jQuery image cropping plugin. As of v4.0.0, the core code of Cropper is replaced with Cropper.js.

  • Demo
  • Cropper.js - JavaScript image cropper (recommended)
  • jquery-cropper - A jQuery plugin wrapper for Cropper.js (recommended for jQuery users to use this instead of Cropper)

Main

dist/
├── cropper.css
├── cropper.min.css   (compressed)
├── cropper.js        (UMD)
├── cropper.min.js    (UMD, compressed)
├── cropper.common.js (CommonJS, default)
└── cropper.esm.js    (ES Module)

Getting started

Installation

npm install cropper jquery

Include files:

<script src="/path/to/jquery.js"></script><!-- jQuery is required -->
<link  href="/path/to/cropper.css" rel="stylesheet">
<script src="/path/to/cropper.js"></script>

Usage

Initialize with $.fn.cropper 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.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');

Options

See the available options of Cropper.js.

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

Methods

See the available methods of Cropper.js.

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

Events

See the available events of Cropper.js.

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

No conflict

If you have to use other plugin with the same namespace, just call the $.fn.cropper.noConflict method to revert to it.

<script src="other-plugin.js"></script>
<script src="cropper.js"></script>
<script>
  $.fn.cropper.noConflict();
  // Code that uses other plugin's "$('img').cropper" can follow here.
</script>

Browser support

It is the same as the browser support of Cropper.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

Версии библиотеки

Версия
4.0.0
2.3.4
2.0.0