Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jcrop default selection box

Tags:

jquery

jcrop

$('#previewImg').Jcrop({
        onChange: showCoords,  
        onSelect: showCoords,
        minSize:[300,100],
        maxSize:[900,900],
        aspectRatio: 3/1
    });

I have an image use jcrop, however i need to have a default box 300,100 before user click on image to make it appear.

so the box will already appear & at center before user click the image.

like image 219
Ben Avatar asked Jan 05 '14 07:01

Ben


Video Answer


1 Answers

you have to set the setSelect option while creating the jcrop

$('#previewImg').Jcrop({
        onChange: showCoords,  
        onSelect: showCoords,
        setSelect: [0, 160, 160, 0],// you have set proper x and y coordinates here
        minSize:[300,100],
        maxSize:[900,900],
        aspectRatio: 3/1
    });

Here is the demo for setSelect option http://deepliquid.com/projects/Jcrop/demos.php?demo=advanced

like image 76
Anto Subash Avatar answered Nov 29 '22 19:11

Anto Subash