I want to have an object which is both resizable and draggable. I'll need:
- X
- Y
- Size
of the object.
Is this possible?
There is an example on http://www.jsfiddle.net/davidThomas/DGbT3/1/ which gets the x and y of the draggable object. How can I also make it resizable?
Thanks
It's worth adding that this question is related to, and built on, this previous question: How to get the position of a draggable object?
If you mean draggable, that something like this:
Size and position you can point with css (first time). Than you can change them and get (when you resize or move) with jQuery.
You can add options to draggable() and resizable() methods. Reference is here: http://jqueryui.com/demos/resizable/ and http://jqueryui.com/demos/draggable/
P.S. This code requires jquery-ui.js file and jquery-ui.css (because it draws a marker to resize)
P.P.S.
With your link: In JavaScript frame I added the line:
And I added css-style in managed resources "http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.8/themes/base/jquery-ui.css"
And it worked!
Sure it is... jQuery UI is good for complex behaviors like drag and drop, resizing, selection and sorting.
With jQuery UI you can:
And you can everything chain together.
It is important for the resize feature that you include the
jquery-ui.css
file.JSFIDDLE: http://jsfiddle.net/uQWRk/
Here is the full code for archive:
See comments: