JQuery Resize div
I want to add a div on click and automatically start resizing the mouse with the mouse.
I can add a div easily, I resize easily. But I can't figure out how to pass the mouse event and bind them to resize right away.
Imagine the same graphics program so that a div can be added and drawn by dragging the mouse ...?
Thank you very much.
a source to share
Since your divs are added to the DOM AFTER the initial event handlers are attached, .bind () will not work on new elements. JQuery has a great .live () method that will do the same as .bind (), but on elements added later in the DOM.
So, you can write something like this:
$ ('. my_new_div'). live ('mousedown', my_resize_handler);
Edit: Also have a look at the new .delegate () method. Very similar to .live (), but more efficient.
a source to share