无法访问 Jquery JCrop api

发布于 2024-12-09 18:35:44 字数 547 浏览 5 评论 0原文

我正在尝试访问 jCrop api ( http://deepliquid.com )。

这是我的代码片段:

// The selected image has been loaded
$('#selectedImage').load(function() {
   var jcrop_api = $('#selectedImage').Jcrop({
                touchSupport:     true,
                onSelect: cropSelected
    });
    jcrop_api.setSelect([ 100,100,200,200 ]);
});

我进入控制台: 类型错误:表达式“jcrop_api.setSelect”[未定义] 的结果不是函数。

我知道我可以传递一些参数作为选项,但我想使用 api 来执行一些其他操作(setImage 等)。

有什么想法吗? 多谢 !

I am trying to access to the jCrop api ( http://deepliquid.com ).

Here is my code snippet :

// The selected image has been loaded
$('#selectedImage').load(function() {
   var jcrop_api = $('#selectedImage').Jcrop({
                touchSupport:     true,
                onSelect: cropSelected
    });
    jcrop_api.setSelect([ 100,100,200,200 ]);
});

I get in the console :
TypeError: Result of expression 'jcrop_api.setSelect' [undefined] is not a function.

I am aware that I can pass some parameters as options, but I would like to use the api to perform some other stuff (setImage, etc.)

Any ideas ?
Thanks a lot !

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

べ繥欢鉨o。 2024-12-16 18:35:44

您以错误的方式调用 api...

将其更改

   var jcrop_api = $('#selectedImage').Jcrop({
                touchSupport:     true,
                onSelect: cropSelected
    });

为:

   var jcrop_api = $.Jcrop('#selectedImage',{
                touchSupport:     true,
                onSelect: cropSelected
    });

You are calling the api in the wrong way...

change this:

   var jcrop_api = $('#selectedImage').Jcrop({
                touchSupport:     true,
                onSelect: cropSelected
    });

to this:

   var jcrop_api = $.Jcrop('#selectedImage',{
                touchSupport:     true,
                onSelect: cropSelected
    });
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文