You are viewing Jcrop 2.x documentation — click here for legacy v0.9.x

Options Reference

Jcrop comes packed with features powerful features that can be controlled by a few configuration directives. After Jcrop is instantiated, options can be updated across the instance, or per individual selection.

Common Features

The most common features

Option NameFormat/defaultDescription
aspectRatiofloat  0Sets aspect ratio (divide width / height)
bgColorstring  'black'Color value for background shading
bgOpacityfloat  0.6Opacity value for background shading
maxSizearray  [ 0, 0 ]Maxium selection size [ w, h ]
minSizearray  [ 8, 8 ]Minimum selection size [ w, h ]

Selection Behavior

Alter the behavior of current, future, and linked selections.

Option NameFormat/defaultDescription
canSelectbool  trueSelection can be selected
canDeletebool  trueSelection can be deleted (via keyboard)
canDragbool  trueSelection can be dragged
canResizebool  trueSelection can be resized
edgeobject  {n:0,s:0,e:0,w:0}Margin from edge of container
linkedbool  falseNew selections inherit this setting once
linkCurrentbool  trueIf set, current selection inherits any setOptions() values

Stage Behavior

These options mostly apply instance-wide.

Option NameFormat/defaultDescription
allowSelectbool  trueAllow new selections to be created with stage dragFalse value disables new selections, overrides multi option
animationbool  trueEnable animation when selection is updated via API
animDurationinteger  400Animation duration (in milliseconds)
animEasingstring  'swing'Animation easing routine
boxHeightinteger  nullMaximum box height
boxWidthinteger  nullMaximum box width
fadingbool  trueEnable fading when bgColor or bgOpacity are updated
fadeDurationinteger  400Fade duration (in milliseconds)
fadeEasingstring  'swing'Fade easing routine
multibool  falseAllow multiple selections
multiCleanupbool  trueControls non-current selection behavior when multi is falseIf true any existing non-current selections are removed
multiMaxinteger  0Maximum simultaneous selections allowed (0 is no limit) If number of selections >= multiMax value, new selections prohibited

Obscure Features

Less likely to be used, but still relevant.

Option NameFormat/defaultDescription
bordersarray  ['n','s','e','w']Array of borders to create
dragbarsarray  ['n','s','e','w']Array of invisible dragbars to create
handlesarray  ['n','s','e','w','ne','se','sw','nw']Array of ord values to set handles for

Changing Options

All options above can be set when attaching Jcrop. Most options can also be changed on-the-fly.
There are several methods for doing this.

You can just call the Jcrop plugin method again, with new options:
$('#target').Jcrop({ bgColor: 'red' });
You can also call the API method setOptions():
jcrop_api.setOptions({ bgOpacity: 0.4 });

(Under the hood, the Jcrop plugin method calls setOptions() if Jcrop is already attached to the element.)