javascript - fengyuanchen cropper how to set up dynamic fixed crop box -


i'm using crop tool fengyuanchen, has awesome features. i'm trying make fixed crop-box dynamic sizes.

but i'm stuck on how figger out how make size.

i've tried following:

$(function() {      $('.img-container > img').cropper({       aspectratio: 16 / 9,       autocroparea: 0.65,       strict: false,       guides: false,       highlight: false,       dragcrop: false,       cropboxmovable: false,       cropboxresizable: false,       setcropboxdata('1600', '1200')     });  }); 

but setcropboxdata doesn't work me. doing wrong?

update on matter:

this should te correct syntax set fixed width actual cropbox, still don't results:

$(function() {   var $tocrop = $('.img-container > img');    $tocrop.cropper({     aspectratio: 16 / 9,     autocroparea: true,     strict: false,     guides: false,     highlight: true,     dragcrop: false,     cropboxmovable: false,     cropboxresizable: false,     built: function () {       $tocrop.cropper("setcropboxdata", { width: "100", height: "50" });     }   }); }); 

i've finaly found solution. , silly syntax error... passing string instead of number setcropboxdata.

here's solution:

$(function() {   var $tocrop = $('.img-container > img');    $tocrop.cropper({     aspectratio: 16 / 9,     autocroparea: 0,     strict: false,     guides: false,     highlight: true,     dragcrop: false,     cropboxmovable: false,     cropboxresizable: false,     built: function () {       // width , height params number types instead of string       $tocrop.cropper("setcropboxdata", { width: 1600, height: 800 });     }   }); }); 

Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -