Create a div by clicking and dragging

I want to be able to create a div in my application by clicking and dragging. Clicking will start creating a div, while dragging will resize the div.

I saw similar functionality in several jquery calendar plugins, I also want to be able to do this in my application.

Can anyone point me in the right direction? Any jQuery plugin or something that I am missing?

Thank you for your help.

+2
source share
2 answers

You can fulfill this plan:

When the mouse button is down, you record the x / y values. When it appears, you record new x / y values. Subtract the first from the last; if the result is not negative, create a div with these sizes.

+3
source

Source: https://habr.com/ru/post/1387045/


All Articles