List of basic parameters of jcrop_jquery
jcrop original download page: Click here
The basic usage is as follows:
1. Insert relevant css and js files in the head section (between and ).
< ;script src="js/jquery.Jcrop.js">
2. Insert the callback function and other related processing parameters in the head part.
3. Add ID to relevant pictures for easy identification.
This can achieve the simplest cropping effect. As for how to process images with dynamic statements such as php, it has been given in the top article Examples are given.
The following table gives the basic options parameter settings:
名称 | 默认值 | 说明 |
---|---|---|
allowSelect | true | 允许新选框 |
allowMove | true | 允许选框移动 |
allowResize | true | 允许选框缩放 |
trackDocument | true | |
baseClass | "jcrop" | 基础样式名前缀。说明:class="jcrop-holder",更改的只是其中的 jcrop。 |
addClass | null | 添加样式会。例:假设值为 "test",那么会添加样式到 class="test jcrop-holder" |
bgColor | "black" | 背景颜色。颜色关键字、HEX、RGB 均可。 |
bgOpacity | 0.6 | 背景透明度 |
bgFade | false | 使用背景过渡效果 |
borderOpacity | 0.4 | 选框边框透明度 |
handleOpacity | 0.5 | 缩放按钮透明度 |
handleSize | 9 | 缩放按钮大小 |
handleOffset | 5 | 缩放按钮与边框的距离 |
aspectRatio | 0 | 选框宽高比。说明:width/height |
keySupport | true | 支持键盘控制。按键列表:上下左右(移动)、Esc(取消)、Tab(跳出裁剪框,到下一个) |
cornerHandles | true | 允许边角缩放 |
sideHandles | true | 允许四边缩放 |
drawBorders | true | 绘制边框 |
dragEdges | true | 允许拖动边框 |
fixedSupport | true | |
touchSupport | null | |
boxWidth | 0 | 画布宽度 |
boxHeight | 0 | 画布高度 |
boundary | 2 | 边界。说明:可以从边界开始拖动鼠标选择裁剪区域 |
fadeTime | 400 | 过度效果的时间 |
animationDelay | 20 | 动画延迟 |
swingSpeed | 3 | 过渡速度 |
minSelect | [0,0] | 选框最小选择尺寸。说明:若选框小于该尺寸,则自动取消选择 |
maxSize | [0,0] | 选框最大尺寸 |
minSize | [0,0] | 选框最小尺寸 |
onChange | function(){} | 选框改变时的事件 |
onSelect | function(){} | 选框选定时的事件 |
onRelease | function(){} | 取消选框时的事件 |
The following table is the api method
名称 | 说明 |
---|---|
setImage(string) | 设定(或改变)图像。例:jcrop_api.setImage("newpic.jpg") |
setOptions(object) | 设定(或改变)参数,格式与初始化设置参数一样 |
setSelect(array) | 创建选框,参数格式为:[x,y,x2,y2] |
animateTo(array) | 用动画效果创建选框,参数格式为:[x,y,x2,y2] |
release() | 取消选框 |
disable() | 禁用 Jcrop。说明:已有选框不会被清除。 |
enable() | 启用 Jcrop |
destroy() | 移除 Jcrop |
tellSelect() | 获取选框的值(实际尺寸)。例子:console.log(jcrop_api.tellSelect()) |
tellScaled() | 获取选框的值(界面尺寸)。例子:console.log(jcrop_api.tellScaled()) |
getBounds() | 获取图片实际尺寸,格式为:[w,h] |
getWidgetSize() | 获取图片显示尺寸,格式为:[w,h] |
getScaleFactor() | 获取图片缩放的比例,格式为:[w,h] |

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Frequently Asked Questions and Solutions for Front-end Thermal Paper Ticket Printing In Front-end Development, Ticket Printing is a common requirement. However, many developers are implementing...

JavaScript is the cornerstone of modern web development, and its main functions include event-driven programming, dynamic content generation and asynchronous programming. 1) Event-driven programming allows web pages to change dynamically according to user operations. 2) Dynamic content generation allows page content to be adjusted according to conditions. 3) Asynchronous programming ensures that the user interface is not blocked. JavaScript is widely used in web interaction, single-page application and server-side development, greatly improving the flexibility of user experience and cross-platform development.

There is no absolute salary for Python and JavaScript developers, depending on skills and industry needs. 1. Python may be paid more in data science and machine learning. 2. JavaScript has great demand in front-end and full-stack development, and its salary is also considerable. 3. Influencing factors include experience, geographical location, company size and specific skills.

Learning JavaScript is not difficult, but it is challenging. 1) Understand basic concepts such as variables, data types, functions, etc. 2) Master asynchronous programming and implement it through event loops. 3) Use DOM operations and Promise to handle asynchronous requests. 4) Avoid common mistakes and use debugging techniques. 5) Optimize performance and follow best practices.

Discussion on the realization of parallax scrolling and element animation effects in this article will explore how to achieve similar to Shiseido official website (https://www.shiseido.co.jp/sb/wonderland/)...

The latest trends in JavaScript include the rise of TypeScript, the popularity of modern frameworks and libraries, and the application of WebAssembly. Future prospects cover more powerful type systems, the development of server-side JavaScript, the expansion of artificial intelligence and machine learning, and the potential of IoT and edge computing.

How to merge array elements with the same ID into one object in JavaScript? When processing data, we often encounter the need to have the same ID...

In-depth discussion of the root causes of the difference in console.log output. This article will analyze the differences in the output results of console.log function in a piece of code and explain the reasons behind it. �...
