Search and Top Navigation
#3876 closed enhancement (wontfix)
Opened January 20, 2009 08:19AM UTC
Closed August 22, 2009 07:39AM UTC
create draggable on mousedown
Reported by: | ecentinela | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | 1.8 |
Component: | ui.draggable | Version: | 1.6rc5 |
Keywords: | draggable mousedown | Cc: | |
Blocked by: | Blocking: |
Description
Before 1.6 this was posible with the code:
$('img').bind('mousedown', function(e) { $(this).draggable().trigger('mousedown.draggable', e); })
But with 1.6rc5, this doesn't works. I think that creating draggables by demand could be a great enhacement.
I know this can be done with the new live method on jquery, but creating draggables on mousedown is a better solution to avoid overhead.
Attachments (0)
Change History (4)
Changed January 22, 2009 09:34AM UTC by comment:1
Changed February 17, 2009 12:20PM UTC by comment:2
component: | ui.core → ui.draggable |
---|---|
milestone: | TBD → 1.6 |
Probably a regression.
Changed March 08, 2009 02:36PM UTC by comment:3
milestone: | 1.7 → 1.8 |
---|
Changed August 22, 2009 07:39AM UTC by comment:4
resolution: | → wontfix |
---|---|
status: | new → closed |
It's a change that was needed in jQuery core, so jQuery core simply doesn't accept events being passed anymore as data. However, there's a new way of doing this, which is even simpler:
$('#draggable').one('mousedown', function(e) {
$("#draggable").draggable().trigger(e);
});
So you bind a onetime executed event to mousedown, and then simply retrigger the mousedown event using trigger(e) (that way you won't have an infinite recursion). This works like a charm!
After some research I have seen that I can do:
It's not too much friendly, but this works. Maybe some option on the draggable method could be introduced for this purpose.