javascript - How to set crop box in jquery cropper -
i'm using cropper, it's jquery plugin found @ cropper web site.
have image size full hd 1920w on 1080h, , need give user ability crop in fixed box size 675*1080, question how set options of plugin ?
i've tried follow no success:
var c1 = $('.cropper-example-1 img').cropper({ //aspectratio: 10 / 16, strict: true, background:false, guides: false, highlight: false, dragcrop: false, movable: false, resizable: false, mousewheelzoom: false, touchdragzomm:false, built: function () { //alert(1); // $(this).cropper('setdata', 0, 0, 675, 1080,90); // $(this).cropper('setcropboxdata', 0, 0, 1920, 1080); } });
try add autocroparea: 0.5,
, changes built method
var $image=$('.cropper-example-1 img'); $image.cropper({ //aspectratio: 10 / 16, strict: true, background:false, guides: false, highlight: false, dragcrop: false, movable: false, resizable: false, mousewheelzoom: false, touchdragzomm:false, autocroparea: 0.5, built: function () { //alert(1); // $(this).cropper('setdata', 0, 0, 675, 1080,90); // $(this).cropper('setcropboxdata', 0, 0, 1920, 1080); $image.cropper('setcanvasdata', 0, 0, 1920, 1080)); $image.cropper('setcropboxdata', 0, 0, 675, 1080); } });
Comments
Post a Comment