Drag & resize image
Drag & resize image
Hi,
How can I create a draggable & resizable image?
js:
$(document).ready(function(){
$("#resizebleImage").draggable();
$("#resizebleImage").resizable({ handles: "all", ghost: true });
});
This makes the image resizable only.
So I tried this code - a double click on the image toggles the resize/
drag functionality. It only works once, the image cannot revert to
draggable.
$("img").dblclick(function () {
toggle();
});
var canDrag=true;
function toggle() {
canDrag=!canDrag;
if (canDrag)
$("#resizebleImage").draggable();
else
$("#resizebleImage").resizable({ handles: "all", autoHide: true });
}
html:
<img id="resizebleImage" src="images/peanut.gif" width="200px"
height="135px">
What have I done wrong?
Steve