attr() issues with droppable().
okeydokey... here we go.
A Demo :-
http://www.edition38.com/ui/uitest3.php
What it does:-
You can drag + drop connectors onto each other, across each of the
'boards' (a grey area is a board). When you drop a connector onto
another it does the following:-
- checks current 'connectedto' attribute.
already has a value
a popup box (via impromptu plugin) is displayed asking the user to
either overwrite the current connection, or keep it.
doesnt have a value set at present.
- sets 'connectedto' attribute of currently dragged element to be the
id of the element onto which it is dropped.
- sets 'connectedto' attribute of dropped element, to be the id of
the element currently being dragged.
- sets some 'mouseover' and 'mouseout' events to enable some css
rollover effects - highlights itself, and the connector to which it
was dropped. it remembers this, using the connectedto attribute.
When you drag a connector, it does the following: -
- checks to see whats droppable. at present, none of the connectors
are actually 'locked' but if a connector already has a valid
'connectedto' attribute, it is given the 'connectorLocked' class,
simply to show the user dragging a connector, that if he DOES drop
onto either of those connectors, that connection will be lost.
The Problem:-
The first time you drag a connector onto another, the 'connectedto'
attributes on both the dragged and dropped elements are set correctly,
meaning that rolling over either of these elements highlights them
correctly as connected to each other.
Dragging another connector shows that the current connection has made
the two connectors 'inadvisable' by bordering them in red.
Hope this is clear!