HTML and CSS Reference
In-Depth Information
add and remove a CSS class like in the earlier example so that you could easily add more
styles in the future. For brevity we'll leave it as is in this example.
The dragOverHandler() function does the real work in this example:
function dragOverHandler(e) {
// make sure the item being dragged isn't the
same as the one we're dragging over
// and make sure it hasn't been removed from the
if (dragging != && dragging.parentNode
!= null)
// determine whether the drag in going
up or down
if (
== dragging ) dir = "down";
else dir = "up";
// remove the item being dragged from
the page
// add item being dragged above
or below the item being dragged over
if (dir == "down"){
= ,;
else if (dir == "up")
= ,;
// prevent the default behavior
if (e.preventDefault) e.preventDefault();
return false;
Search WWH ::

Custom Search