Opened 9 years ago

Closed 8 years ago

#3876 closed enhancement (wontfix)

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:


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.

Change History (4)

comment:1 Changed 9 years ago by ecentinela

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.

comment:2 Changed 9 years ago by Jörn Zaefferer

Component: ui.coreui.draggable
Milestone: TBD1.6

Probably a regression.

comment:3 Changed 9 years ago by rdworth

Milestone: 1.71.8

comment:4 Changed 8 years ago by paul

Resolution: wontfix
Status: newclosed

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) {



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!

Note: See TracTickets for help on using tickets.