The*_*ech 7 javascript jquery jcrop
我想在图片的中心开始JCrop选择.有办法吗?
有选择还是什么?它没有在手册中指定.
我们必须手动计算吗?
TJ-*_*TJ- 16
如果您无法弄清楚如何在中心设置选择:
检查设置选项http://deepliquid.com/content/Jcrop_Manual.html#Setting_Options
这样的东西(取自API参考):
<script language="Javascript">
jQuery(function($) {
$('#target').Jcrop({
onSelect: showCoords,
bgColor: 'black',
bgOpacity: .4,
setSelect: [ x, y, x1, y1 ],
aspectRatio: 16 / 9
});
});
</script>
Run Code Online (Sandbox Code Playgroud)
如果w is the width和h is the height所需的选择和W is the width of the image,H is the height of the image坐标将是
x = W/2 - w/2
y = H/2 - h/2
x1 = x + w
y1 = y + h
Run Code Online (Sandbox Code Playgroud)
(我希望我的数学是正确的:)