I have this function which initializes jwindowcrop based on the predefined height and width
$('img#imgcrop_'+picSize+'_form_'+id).jWindowCrop({
targetWidth: 400,
targetHeight: 300,
loadingText: 'Loading image...',
//and so on
However, I need to provide a feature to allow use to choose from "landscape" or "portrait" orientation and so I need to re-set the width and height to 300w and 400h. How can I possibly do this without re-initializing jwindowcrop?
In case you don't have the original reference to it and provided you know, for example, the element to which the jWindowCrop is bound, you can get a reference as follows:
var jwc = $(selector).getjWindowCrop();
From there on you can easily modify any of the set options.
jwc.options.zoomSteps = 2
However from the basic documentation it seems that there are no setters for targetWidth
and targetHeight
so you'll need to manually control it as shown below.
var newHeight = 200;
jwc.$frame.height(newHeight);
jwc.options.targetHeight = newHeight;
Additional complications may exist, but this is the basic gist of it.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.