Crop plugin Jcrop

Source: Internet
Author: User

For everyone to introduce a plugin: Jcrop. This plugin is used by me in a number of projects, such as by drawing the heat force to see the number of users of a block, zoom in and out drag box to preview the selected area of the picture disease crop, set the avatar is the box must be a square, it has rich configuration parameters and callback functions.

Its commonly used parameters and callback methods can be found on the Internet, such as whether to allow drag and drop, whether to allow the new marquee, marquee allowed size, color, border, disable the marquee, destroy the marquee, recall the marquee, etc., easy to use.

Use this method:

1. Loading CSS

  <link rel="stylesheet" href="jquery.Jcrop.css">

2. Loading JavaScript files

<script src= "jquery.js" > </SCRIPT>

  <script src="jquery.Jcrop.js"></script>

3. Add an ID to the IMG tag

  <img id="element_id" src="pic.jpg">

4. Call Jcrop

  $(‘#element_id‘).Jcrop();

For example, to implement the selected area must be a square, you need to write:

$ (' #element_id '). Jcrop ({aspectradio:1});

The aspect ratio is 1 to meet the requirements.

Crop plugin Jcrop

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.