I came across this question today:
(Following is the very first version)
I have a div tag to which I attach the draggable event of jquery. But when the user drags this div, I would like to create a new dynamic div ( containing additional information ) and attach this div for dragging. So it should appear as if this div is being dragged. How should I go about this ?
Note - I tried attaching mouse down to main div and create dynamic div but attaching mouse events seems to be buggy.
(I agree it isn't great, but it can surely be improved.)
The question was tagged jquery and jquery-ui.
For someone who is not familiar with jquery-ui, It might seem to be a broad or not specific question.
This question is now on hold as off-topic with following reason:
Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers
(emphasis mine)
and there are comments below the question saying this is too broad, tell us what is not working etc.
Now,
The question is not asking for debugging help. The OP is not asking the community to fix his code, Instead, he is asking how to do something
When I look at it, the question has a clear problem statement - OP wants to display a dynamically generated
<div>
while dragging rather than the original one being dragged.There is no such thing as code required to reproduce this in this case because there is no particular error happening. The OP simply has a draggable
<div>
, that's it - And the code for creating it is pretty obvious for someone who is familiar with the tag, because it's a one liner like$("div").draggable();
(If one doesn't know the ^ above one liner, and is asking for this code, then he probably isn't familiar with the topic)
And If you ask me, it is likely that others might have the same question in future too.
In reality, there is a built in option for achieving what the OP wants in jquery-ui, and someone familiar with using it can point it out.
Now if you ask me, the question could be downvoted sighting the lack of research reason for not finding the docs and understanding it, even though my first google search didn't return anything (I might be using the wrong terms).
For someone familiar with jQuery UI draggable functionality, I don't think this will be off topic.
Now, Did jquery-ui experts voted to close this..?
If not, Should someone not familiar with the topic vote to close something by the looks of it..?
If familiarity with the topic is not the case, can someone tell me, Why this is actually off-topic..?
Update
It looks like many are not understanding the scenario.
The scenario is this:
OP asks how to do X
. and mentions something he tried didn't work.
Simply put, my questions are,
- Does the question become off-topic because he didn't show his failed attempt..?
- Should one vote to close If they are note familiar with the topic..?
Conclusion:
Back in 2008, question asking How to do X
and answers were well received and gained upvotes by those who found it useful later.
In 2014
:, Questions caused by typing mistakes of OP and their answers gains upvotes, might not even get closed, and will never get deleted.
Questions asking How to do X
and answers will be downvoted as well as closed, unless there is a piece of code which is not at all required to solve the issue, and will be fed to roomba.
Lesson Learned: (As of 2014) I should not answer questions asking How to do X
, even though it might be useful to future readers and I can solve the issue, unless OP posts a piece of code (Even though it is not at all necessary to solve the issue). Instead, I should vote to close the question.
Thanks everyone.
Update
The question is now deleted. The information is gone and anyone coming across this issue will come back with the same question.
Side note: My attempt to improve the question or re-open vote doesn't seem to do anything for the past few hours, It is still receiving downvotes and even the answer gets downvoted! (Can't be sure it's related to the question quality though), Which in fact prompted me to bring it here.
$("div").draggable();
is so common (I admit I'm totally unfamiliar with jquery), why didn't the OP added in the question? How will others - not totally familiar with jquery-ui - figure that he did use that? And why don't you just edit the question and add it, if you are dead sure that's what everyone uses? The question might then be re-opened. I find the close reason perfectly just.helper: function () {...}