2014-01-28 65 views
0

問題是這樣的:當我用這樣的參數初始化Jcrop,下面,一切工作正常,但我添加setSelect:[100,100,50,50],與任何參數setSelect:[0 ,0,430,300],不管了,我在控制檯錯誤jcrop後添加setSelect奇怪的錯誤

Uncaught TypeError: Object [object global] has no method 'tellSelect'

我的代碼是:

longFooter.find('#cutImage').click(function(){ 
    $('#target').Jcrop({ 
     aspectRatio: 43/30, 
     keySupport: false, 
     maxSize:[430, 300], 
     trueSize: [parseInt(img.attr("native-width")),parseInt(img.attr("native-height"))], 
     bgColor: 'black', 
     bgOpacity: .4, 
     onSelect: function(){ 
      var selection = this.tellSelect(); 
      var src_x = selection.x; 
      var src_y = selection.y; 
      var dest_w = selection.w; 
      var dest_h = selection.h; 
      $('#dllImage').removeAttr("onclick"); 
      $('#dllImage').attr("onclick", "getCropImage("+"''"+","+"'"+cropUrl+"'"+","+"'"+src_x+"'"+","+"'"+src_y+"'"+","+"'"+dest_w+"'"+","+"'"+dest_h+"'"+")"); 
      console.log(src_x, src_y, dest_w, dest_h); 
     } 
    }); 

回答

0

我知道這是舊的,但您可能需要更改此:

var selection = this.tellSelect();

到這一點:

var selection = $(this).tellSelect();