YUI: DragDrop ALWAYS on top
1
2
3
The Javascript
(function() { var Dom = YAHOO.util.Dom, Event = YAHOO.util.Event; // Our custom drag and drop implementation, extending YAHOO.util.DD YAHOO.example.DDOnTop = function(id, sGroup, config) { YAHOO.example.DDOnTop.superclass.constructor.apply(this, arguments); }; //Cache the zIndex YAHOO.util.DDM._curZindex = 999; YAHOO.extend(YAHOO.example.DDOnTop, YAHOO.util.DD, { startDrag: function(x, y) { YAHOO.log(this.id + " startDrag", "info", "example"); var style = this.getEl().style; // The z-index needs to be set very high so the element will indeed be on top style.zIndex = YAHOO.util.DDM._curZindex; //Up the zIndex so the next call makes it higher YAHOO.util.DDM._curZindex++; } }); var dd, dd2, dd3; Event.onDOMReady(function() { dd = new YAHOO.example.DDOnTop("dd-demo-1"); dd2 = new YAHOO.example.DDOnTop("dd-demo-2"); dd3 = new YAHOO.example.DDOnTop("dd-demo-3"); }); })();