Scriptaculous Droppables Tweak

Scriptaculous has some fairly slick drag and drop facilities built in, though they're clearly targeted at backing some of the other features (like Sortables). I was playing today and noticed the lack of an onUnhover callback corresponding to the onHover method of a Draggable (i.e. a drop-zone). That's not needed for Sortables, but it is if you want to give any sort of visual feedback on hover (like green/red for allowed/disallowed) that needs to be reset at the end of the hover. A quick couple lines to dragdrop.js and bingo: onUnhover Scriptaculous patch.

To use, define an onUnhover callback just like the standard onHover on, excepting that you only get passed the droppable (which is the onHover callback's second parameter).

One response to “Scriptaculous Droppables Tweak”

  1. joshiausdemwald

    hiho,
    don't know if its interesting for you, but i've been searching for a quite similar solution in scriptaculous 1.8.1 for a while. well, here we go:

    (line 78 dragdrop.js)
    deactivate: function(drop) {
    if(drop.onUnhover)
    drop.onUnhover(drop.element);

    thanks for your few inspiring loc ;)