I want to use a drag to select feature, but rather than select a square area on screen, and select anything within that square, I want to select any element between my initial choice and the one I release the click on.
This is best explained visually. I do not want to do this:

Instead I want to do this:

After the previous failed attempt I’ve now come up with a working solution. It would appear that jQuery UI selectable is not suitable, as it uses that rectangular selection, so I’ve had to roll my own.
In the example below (see jsFiddle for full code), the selectable elements are
a.date. These elements should haveposition: relativeset.Firstly, I append a child element with class
.drag-proxy. This is positioned absolutely, and covers the same area as the child. It’s got no content so it sits transparently above.These proxy elements are made draggable and droppable.
When the element is dragged and dropped onto another element, it is moved back to its starting point (so that subsequent selections work).
Then we cycle through all the proxy elements, indentifying the elements in the selection range, and then setting a class on the parent
a.dateelement.See the jsFiddle for the full example.