2014-10-28 47 views
0

我使用jquery.Jcrop.js來裁剪圖像。我有三個圖像和圖像進入一個循環,需要分別裁剪。我的代碼在Firefox中工作正常,但在Chrome中,當我裁剪第二張圖片時,控件進入第三張圖片(在第一張圖片中,這工作正常),我不知道爲什麼。我檢查了一切,但沒有得到任何問題。我正在使用以下功能jquery.Jcrop.js在Chrome中沒有正常工作

function countTest(){ 
     $(".HM_img_cotent .preview").each(function(index) { 
     var HM_index = index+1; 
     jcrop_api = this; 
     $('#cropbox_'+HM_index).Jcrop({ 
      aspectRatio: 1, 
      dragEdges: false, 
      //createHandles: ['n','s','e','w','nw','ne','se','sw'], 
      onRelease: function() { 
        clearCoords(HM_index); 
      }, 
      onSelect: function (coords) { 
        updateCoords(coords, HM_index); 
      } 
     }); 
    });  
} 

    function updateCoords(c, HM_index) 
    { 
     $('#x_'+HM_index).val(c.x); 
     $('#y_'+HM_index).val(c.y); 
     $('#w_'+HM_index).val(c.w); 
     $('#h_'+HM_index).val(c.h); 
    }; 

    function clearCoords(HM_index) 
    { 
     $('#x_'+HM_index).val(''); 
     $('#y_'+HM_index).val(''); 
     $('#w_'+HM_index).val(''); 
     $('#h_'+HM_index).val(''); 
    }; 

主函數被調用在ajax函數中。

注意:每個圖像尺寸是1000px x 1000px。

jsfiddle Example is here

回答

0

我得到這個問題的解決方案。

轉到jquery.Jcrop.js文件。

查找keySupport: true,

,代之以

keySupport: false,

相關問題