Resize Element with box handles in corners

Mironline picture Mironline · Jul 11, 2012 · Viewed 11.6k times · Source

in Jcrop , after selecting cropping area , a div appears with box handles in corners.

Is there any jQuery plugin that can build this type of box handles ?

Answer

Randy Gonzalez picture Randy Gonzalez · Jul 13, 2012

You can use jQuery UI's resizable as noted above. I even setup a fiddle for ya!

http://jsfiddle.net/digitalaxis/j2JU6/

jQUERY

$('#element').resizable({
    handles: {
    'ne': '#negrip',
    'se': '#segrip',
    'sw': '#swgrip',
    'nw': '#nwgrip'
    }
});

HTML

<div class="ui-resizable-handle ui-resizable-nw" id="nwgrip"></div>
<div class="ui-resizable-handle ui-resizable-ne" id="negrip"></div>
<div class="ui-resizable-handle ui-resizable-sw" id="swgrip"></div>
<div class="ui-resizable-handle ui-resizable-se" id="segrip"></div>

CSS

#elementResizable {
    border: 1px solid #000000;
    width: 300px;
    height: 40px;
    overflow: hidden;
}
#nwgrip, #negrip, #swgrip, #segrip, #ngrip, #egrip, #sgrip, #wgrip {
    width: 10px;
    height: 10px;
    background-color: #ffffff;
    border: 1px solid #000000;
}
#segrip {
    right: -5px;
    bottom: -5px;
}