0
我有jCrop的問題。他funcuina在其他瀏覽器,但不工作在IE8。我找不到問題。如果是圖像數據問題或圖像尺寸不允許裁切。有人可以幫忙嗎?Jcrop IE8不工作
<script type="text/javascript">
jQuery(document).ready(function() {
// Create variables (in this scope) to hold the API and image size
var jcrop_api, boundx, boundy;
var $targetImage = jQuery('.targetImage'), targetImageDOM = $targetImage[0];
var carregarJcrop = function() {
$targetImage.Jcrop({
onChange: updatePreview,
onSelect: updatePreview,
aspectRatio: 1
}, function() {
// Use the API to get the real image size
var bounds = this.getBounds();
boundx = bounds[0];
boundy = bounds[1];
// Store the API in the jcrop_api variable
jcrop_api = this;
});
function updatePreview(c) {
if (parseInt(c.w) > 0) {
var rx = 231/c.w;
var ry = 231/c.h;
jQuery('#x').val(c.x);
jQuery('#y').val(c.y);
jQuery('#w').val(c.w);
jQuery('#h').val(c.h);
jQuery('.jcrop-preview').css({
width: Math.round(rx * boundx) + 'px',
height: Math.round(ry * boundy) + 'px',
marginLeft: '-' + Math.round(rx * c.x) + 'px',
marginTop: '-' + Math.round(ry * c.y) + 'px'
});
}
};
};
var checaCarregamento = function() {
if (targetImageDOM.complete) {
carregarJcrop()
} else {
setTimeout(checaCarregamento, 500);
}
};
if ($targetImage.length > 0)
setTimeout(checaCarregamento, 500);
});