Opened 7 years ago

Closed 7 years ago

#8413 closed feature (worksforme)

Add HTML class to BODY tag when dragging an element

Reported by: toinus Owned by:
Priority: minor Milestone: 1.9.0
Component: ui.draggable Version: 1.8.20
Keywords: Cc:
Blocked by: Blocking:

Description

It would be great to have an extra CSS class added to the BODY element when something is dragged. So far only an inline style is set : 'cursor: move'.

Adding a class (like 'drag-on') would let define useful CSS styles like : body.drag-on .empty-container { border: 1px dashed #CCCCCC } to easily identify where the element could be dragged to, while not perturbing the user until a drag-drop action is initiated.

Change History (1)

comment:1 Changed 7 years ago by rdworth

Resolution: worksforme
Status: newclosed

This already exists. See http://docs.jquery.com/UI/Droppable#option-activeClass for documentation and http://jqueryui.com/demos/droppable/#visual-feedback for a demo (the second drag-drop pair).

If you want a class added to the html element, use the dragstart and dragstop events to add and remove it.

Note: See TracTickets for help on using tickets.