Croppie 在 Jquery Fancybox 弹出模式中不工作

Croppie is Not Working in Jquery Fancybox popup modal

我曾使用 Jquery Croppie 来满足弹出模型中裁剪或缩放图像的要求,我曾使用 fancybox 在弹出模型中显示图像,现在我想制作裁剪图像或缩放图像我试过弹出模式,但它不再工作了。 我用

完成了弹出模式
<a data-fancybox="gallery" href="{{ asset('public/img/noimage.png') }}" id="fancybox_anchor">
   <div id="profile_pic_div" style="background-image: url('{{ asset('public/img/noimage.png') }}')"></div>
</a>

弹出模型完美地显示了图像,但现在我想使用 croppie 对其进行裁剪、缩放、调整大小 我试过,

$( '.fancybox-image-wrap img' ).croppie({
        enableExif: true,
        viewport: {
            width: 250,
            height: 250,
        },
        type: 'circle',
        boundary: {
            width: 300,
            height: 300
        }
});

当 Popup 打开时,Image parent class 是 fancybox-image-wrap 这就是我将其作为选择器的原因。在正常模式下它的工作但我怎么能在弹出模型中做到这一点。请帮忙。我完全陷入了这个。

谢谢。

下面是使用回调初始化 croppie 并获取结果的更完整示例:

var myCroopie;

$('[data-fancybox="images"]').fancybox({
  touch: false, 
  clickContent: false,
  animationEffect: false,
  afterLoad : function(instance, current) {
    myCroopie = current.$image.croppie({
    });
  },
  beforeClose : function() {
    myCroopie.croppie('result', 'html').then(function(html) {
      // html is div (overflow hidden)
      // with img positioned inside.
      $("#rez").html(html);
    });
  }
});

演示 - https://codepen.io/anon/pen/bvjeLZ?editors=1010