jQuery: The Write Less, Do More JavaScript Library

How to find the new size of a div via the resizeable stop function call?

View: New views
2 Messages — Rating Filter:   Alert me  

How to find the new size of a div via the resizeable stop function call?

by paulbm@gmail.com :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


I'm working on my first JQuery UI routine and have divs that are
stretched by the user. The size snaps nicely to a grid, but I'm having
trouble making sense of the e and ui variables that are passed by the
stop function.
Can anyone point me to information on these structures, or some
examples of people using the values when resizing stops. All the demos
I've found just size the divs but do nothing afterwards.

Thanks
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "jQuery UI" group.
To post to this group, send email to jquery-ui@...
To unsubscribe from this group, send email to jquery-ui-unsubscribe@...
For more options, visit this group at http://groups.google.com/group/jquery-ui?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: How to find the new size of a div via the resizeable stop function call?

by Richard D. Worth-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Every UI plugin callback has two parameters. The first is an event. The second is the ui hash, a collection of useful properties you may need in the callback. For resizable you've got three callbacks:

* start
* resize
* stop

The browser events (the first parameter) that correspond to these are

* mousedown
* mousemove
* mouseup

Having the event object can provide information (useful at times) such as mouse position and modifier keys.

The ui hash is documented here:

http://docs.jquery.com/UI/Resizables/resizable

Or you can always use firebug and do a console.log(ui) inside your callback. It would seem that ui.size would work here, but it doesn't reflect grid snapping values, instead the computed size of the element before it's snapped to the grid. So in your case, to get the grid snapped values, you want

ui.helper.width()
ui.helper.height()

- Richard

On Tue, Jul 22, 2008 at 10:18 AM, paulbm <paulbm@...> wrote:

I'm working on my first JQuery UI routine and have divs that are
stretched by the user. The size snaps nicely to a grid, but I'm having
trouble making sense of the e and ui variables that are passed by the
stop function.
Can anyone point me to information on these structures, or some
examples of people using the values when resizing stops. All the demos
I've found just size the divs but do nothing afterwards.

Thanks



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "jQuery UI" group.
To post to this group, send email to jquery-ui@...
To unsubscribe from this group, send email to jquery-ui-unsubscribe@...
For more options, visit this group at http://groups.google.com/group/jquery-ui?hl=en
-~----------~----~----~----~------~----~------~--~---