Internet explorer 8 是什么原因导致我的jcrop脚本在ie8和ie10中无法运行,而它在ie9和所有其他主要浏览器中运行?

Internet explorer 8 是什么原因导致我的jcrop脚本在ie8和ie10中无法运行,而它在ie9和所有其他主要浏览器中运行?,internet-explorer-8,internet-explorer-9,internet-explorer-10,jcrop,Internet Explorer 8,Internet Explorer 9,Internet Explorer 10,Jcrop,我很难调试它,因为它没有返回任何错误,并且在ie9中运行。我想知道是否有一些常见的问题导致脚本在ie9中运行,而不是在ie8和ie10中运行。我觉得这个bug跳过一个版本很奇怪 我的代码: <script type="text/javascript"> jQuery(function($){ // Create variables (in this scope) to hold the API and image size var jcrop_api

我很难调试它,因为它没有返回任何错误,并且在ie9中运行。我想知道是否有一些常见的问题导致脚本在ie9中运行,而不是在ie8和ie10中运行。我觉得这个bug跳过一个版本很奇怪

我的代码:

<script type="text/javascript">     

  jQuery(function($){

    // Create variables (in this scope) to hold the API and image size
    var jcrop_api,
        boundx,
        boundy,

        // Grab some information about the preview pane
        $preview = $('#preview-pane'),
        $pcnt = $('#preview-pane .preview-container'),
        $pimg = $('#preview-pane .preview-container img'),

        xsize = $pcnt.width(),
        ysize = $pcnt.height();

    console.log('init',[xsize,ysize]);
    $('#picture').Jcrop({
      aspectRatio: <?php echo $_POST["aspectRatio"]; ?>,
      setSelect:   [ 0, 0, 300, 300 ],
      onSelect: updateCoords
    },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;

      // Move the preview into the jcrop container for css positioning
      $preview.appendTo(jcrop_api.ui.holder);
    });


    function updatePreview(c)
    {
      if (parseInt(c.w) > 0)
      {
        var rx = xsize / c.w;
        var ry = ysize / c.h;

        $pimg.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'
        });
      }
    };

        function updateCoords(c)
  {
    $('#x').val(c.x / <?php echo $correctieCoordinates; ?>);
    $('#y').val(c.y / <?php echo $correctieCoordinates; ?>);
    $('#w').val(c.w / <?php echo $correctieCoordinates; ?>);
    $('#h').val(c.h / <?php echo $correctieCoordinates; ?>);
  };

  function checkCoords()
  {
    if (parseInt($('#w').val())) return true;
    alert('Please select a crop region then press submit.');
    return false;
  };      

  });   

</script>

jQuery(函数($){
//创建变量(在此范围内)以保存API和图像大小
var jcrop_api,
庞德,
庞迪,
//获取有关预览窗格的一些信息
$preview=$(“#预览窗格”),
$pcnt=$(“#预览窗格.预览容器”),
$pimg=$(“#预览窗格.预览容器img”),
xsize=$pcnt.width(),
ysize=$pcnt.height();
log('init',[xsize,ysize]);
$(“#图片”).Jcrop({
方面:,
setSelect:[0,0,300,300],
onSelect:updateWord
},函数(){
//使用API获得真实的图像大小
var bounds=this.getBounds();
boundx=边界[0];
boundy=边界[1];
//将API存储在jcrop_API变量中
jcrop_api=这个;
//将预览移动到jcrop容器中以进行css定位
$preview.appendTo(jcrop_api.ui.holder);
});
函数updatePreview(c)
{
如果(parseInt(c.w)>0)
{
var rx=xsize/c.w;
var ry=ysize/c.h;
$pimg.css({
宽度:数学圆(rx*boundx)+“px”,
高度:数学圆(ry*boundy)+“px”,
marginLeft:“-”+数学四舍五入(rx*c.x)+“px”,
marginTop:“-”+数学圆(ry*c.y)+“px”
});
}
};
函数updateCoords(c)
{
$('#x').val(c.x/);
$('y').val(c.y/);
$('w').val(c.w/);
$('h').val(c.h/);
};
函数checkCoords()
{
if(parseInt($('#w').val())返回true;
警报('请选择作物区域,然后按提交');
返回false;
};      
});   
jcrop函数在ie8和ie10中没有初始化。但在ie9和所有主流浏览器中都能正常工作。

正在改变

$('#picture').Jcrop({


成功了。

IE甚至不再是主流浏览器了?:)哦,我希望不是。这就是我的希望P
jcrop_obj = jQuery.Jcrop('#picture', {