GB_001 Posted August 23, 2009 Share Posted August 23, 2009 Hi my dragscript lags terribly when there is a nested div inside a table, is there anyway to stop this? Thanks, GB. Drag script: var ie = document.all; var nn6 = document.getElementById &&! document.all; var isdrag = false; var x, y; var dobj; function movemouse( e ) { if( isdrag ) { dobj.style.left = nn6 ? tx + (e.pageX || (e.clientX + (document.documentElement.scrollLeft ||document.body.scrollLeft)-(document.documentElement.clientLeft || 0)))- x : tx + event.clientX - x; dobj.style.top = nn6 ? ty + (e.pageY || (e.clientY + (document.documentElement.scrollTop ||document.body.scrollTop)-(document.documentElement.clientTop || 0)))- y : ty + event.clientY - y; return false; } } function selectmouse( e ) { var fobj = nn6 ? e.target : event.srcElement; var topelement = nn6 ? "HTML" : "BODY"; while (fobj.tagName != topelement && fobj.className != "dragme") { fobj = nn6 ? fobj.parentNode : fobj.parentElement; } if (fobj.className=="dragme") { if(isdrag==true) { isdrag = false; }else{ isdrag = true; dobj = document.getElementById(VV); tx = parseInt(dobj.style.left+0); ty = parseInt(dobj.style.top+0); x = nn6 ? (e.pageX || (e.clientX + (document.documentElement.scrollLeft ||document.body.scrollLeft)-(document.documentElement.clientLeft || 0))) : event.clientX; y = nn6 ? (e.pageY || (e.clientY + (document.documentElement.scrollTop ||document.body.scrollTop)-(document.documentElement.clientTop || 0))) : event.clientY; document.onmousemove=movemouse; return false; } } } document.onmousedown=selectmouse; document.onmouseup=new Function("isdrag=false"); Quote Link to comment Share on other sites More sharing options...
haku Posted August 24, 2009 Share Posted August 24, 2009 Tables can be heavy for browsers to deal with, particularly if you have nested tables. That could be causing your troubles - maybe switch to a non-table based layout. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.