javascript - How can I make a 'button' create a movable DIV onMouseDown, and switch the 'MouseDown' to the new DIV? -


So I have not started writing any of these so far, so for this sake of some pseudocled clarity - but here It is an idea that a user will click on the 'button' and hold it (maybe it is not a real button), then a movable DIV is produced. Once the DIV is created (whenever the mouse is on time, maybe a little offset, the mouse is inside the divide), I would like to change my 'focus' to a new, moving divi, so that it is located on the screen Happen; At that time I will do some other operations on DIV - but after this point the rest is irrelevant to the question.

Really, incomplete pseudocode - it's almost what I am; And I believe that my biggest question is how can I really change the focus of my grab.

  & lt; Script & gt; Function nudive () {nudive = constant dive (mouse x, mouse you); GrabDiv (NewDiv); } Functions CreateDiv (X, Y) {// DOM for a new DIV ... I have covered this part ... // Walkable for jQuery - Cover NewDiv.style.left = (X - 3) + "Px"; NewDiv.style.top = (Y-3) + "PX"; Nudive's return; } Function GrabDiv (Div) {// Here is the question ... // Div.Focus? - Since the mouse is still down, I think it will work? // Div.onMouseDown? - Bushoot ... Is it going to interact properly with the mouse? } & Lt; / Script & gt; & Lt; Input type = 'button' onMouseDown = 'NewDiv ();' Value = "span a divi" /> Now - again, the real question is what will be the 'fair' approach to the 'Gradidive' function. Any Feedback is much appreciated; And if I need to expand to everyone then I am happy. 

- It seems that there may be at least one other post on something like this; Perhaps a small collision with a very complex answer will encourage a new answer. Hopes

Have you done this somewhere else?

I see JQuery-UI using drag and drop.

EDIT: I think this works as I would use this JSN as a starting point:


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -