Download the X Distribution File.
xEnableDrop(ele, fnDrop)
Default
// xEnableDrop r3, Copyright 2006-2007 Michael Foster (Cross-Browser.com)
// Part of X, a Cross-Browser Javascript Library, Distributed under the terms of the GNU LGPL
function xEnableDrop(id, f)
{
var e = xGetElementById(id);
if (e) {
e.xDropEnabled = true;
xEnableDrag.drops[xEnableDrag.drops.length] = {e:e, f:f};
}
}
xEnableDrag.drop = function (el, ev) // static method
{
var i, z, hz = 0, d = null, da = xEnableDrag.drops;
for (i = 0; i < da.length; ++i) {
if (da[i] && da[i].e.xDropEnabled && xHasPoint(da[i].e, ev.pageX, ev.pageY)) {
z = parseInt(da[i].e.style.zIndex) || 0;
if (z >= hz) {
hz = z;
d = da[i];
}
}
}
if (d) {
d.f(d.e, el, ev.pageX, ev.pageY); // drop event
}
}
drag4.html - A test page for xEnableDrag and xEnableDrop.
By your use of X and/or CBE and/or any Javascript from this site you consent to the GNU LGPL - please read it. If you have any questions about the license, read the FAQ and/or come to the forums.
Forum support is available at the X Library Support Forums.
Cross-Browser.com is the home of X - a cross-browser Javascript library, and many demos, applications, articles and documentation.
If you are using X, XC or anything from this site, show off your work by posting a link in the X Showcase forum.