在弹出模型中,我使用Jquery 克罗皮来要求裁剪或缩放图像,在弹出模式中使用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>
弹出式模型很好地显示了图像,但现在我想用我曾经尝试过的鳄鱼来实现它的裁剪、缩放、尺寸调整,
$( '.fancybox-image-wrap img' ).croppie({
enableExif: true,
viewport: {
width: 250,
height: 250,
},
type: 'circle',
boundary: {
width: 300,
height: 300
}
});
当弹出打开时,Image类是fancybox-image-wrap
,这就是为什么我把它作为选择器。在正常模式下,它可以工作,但如何在弹出模型中做到这一点。请帮帮忙。我完全被困在这里面了。
谢谢。
发布于 2018-04-03 22:27:24
下面是一个更完整的使用回调来初始化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://stackoverflow.com/questions/49613929
复制相似问题