Jquery jcrop-中心的默认作物选择
我在ASP.NET C#应用程序中使用JCrop来裁剪图像。 默认情况下,我希望裁剪选择区域设置在图像的中心, 这是我当前的代码,但问题是,它总是以0,0开始选择Jquery jcrop-中心的默认作物选择,jquery,asp.net,image-resizing,jcrop,Jquery,Asp.net,Image Resizing,Jcrop,我在ASP.NET C#应用程序中使用JCrop来裁剪图像。 默认情况下,我希望裁剪选择区域设置在图像的中心, 这是我当前的代码,但问题是,它总是以0,0开始选择 $('#img_crop').Jcrop({ //img_crop is the ID of image control onChange: updatePreview, // will display the selected img on change.
$('#img_crop').Jcrop({ //img_crop is the ID of image control
onChange: updatePreview, // will display the selected img on change.
onSelect: updatePreview, // will display the selected img Img_preview
bgColor: 'black',
bgOpacity: .6,
//setSelect: [100, 100, 240, 240],
setSelect: [ ($('#img_crop').attr('width') / 2) - 70,
($('#img_crop').attr('height') / 2) - 70,
($('#img_crop').attr('width') / 2) + 70,
($('#img_crop').attr('height') / 2) + 70
],
onSelect: storeCoords, // will tell the coordinates
aspectRatio: 1
}
“宽度”和“高度”属性可能未设置。我宁愿使用$(''img_-crop').width()和$(''img_-crop').height(),看看这是否有效 检查这一个解决方案是什么??