添加setSelect奇怪错误后jcrop

时间:2014-01-28 07:58:38

标签: behavior jcrop

问题是这样的:当我用下面的参数初始化Jcrop时,一切正常但在我添加setSelect:[100,100,50,50]后,任何参数setSelect:[0,0,430,300 ],无论如何,我在控制台中有错误

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);
        }
    });

1 个答案:

答案 0 :(得分:0)

我知道这个年龄较大,但您可能需要更改此内容:

var selection = this.tellSelect();

进入这个:

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