首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >jQuery窗口插件检查当前图像是否可缩放

jQuery窗口插件检查当前图像是否可缩放
EN

Stack Overflow用户
提问于 2015-03-06 20:07:05
回答 1查看 895关注 0票数 0

我使用这个插件来裁剪图像:http://scottcheng.github.io/cropit/

我想知道如何找出当前图像是否可缩放,以便我可以隐藏缩放div,如果不是,它说这个函数是为它:$imageCropper.cropit('isZoomable');,但如何使用它?我是jQuery的初学者。到目前为止,这是我的代码:

代码语言:javascript
复制
    $(function() {
        $('.image-editor').cropit({ imageBackground: true, imageBackgroundBorderWidth: 15 });

if ($('.image-editor').cropit('isZoomable')) { 
            alert("you can zoom");
        } // EDIT: I added it but it's not working

            $('form').submit(function() {
                // Move cropped image data to hidden input
                var imageData = $('.image-editor').cropit('export', {
                                                            type: 'image/jpeg',
                                                            quality: .9
                                                            });
                $('.hidden-image-data').val(imageData);

                // Print HTTP request params
                var formValue = $(this).serialize();

                $.ajax({
                type: 'post',
                url: 'doupload.php',
                data: {bilddata: formValue},
                success: function(data) {

                }
               });
                return false;
            });
        })
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-03-06 20:17:44

就像这样:

代码语言:javascript
复制
if ($('.image-editor').cropit('isZoomable')) {
    // code
}
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/28906765

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档