Search code examples
jqueryjcrop

Jcrop default selection box


$('#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.


Solution

  • 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