Hi all.
In a nutshell, I have a page with colour swatches.
I have implemented some JS and CSS in order for a user to "move" the swatches around so they can take different colours and move them next to each other in order to see how they look side by side on the site.
I reference the js in the head, and call it in a CSS class.
works in IE but not in Firefox.
any help?
JS file:
HTML head:Code: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.clientX - x : tx + event.clientX - x; dobj.style.top = nn6 ? ty + e.clientY - 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") { isdrag = true; dobj = fobj; tx = parseInt(dobj.style.left+0,10); ty = parseInt(dobj.style.top+0,10); x = nn6 ? e.clientX : event.clientX; y = nn6 ? e.clientY : event.clientY; document.onmousemove=movemouse; return false; } } document.onmousedown=selectmouse; document.onmouseup=new Function("isdrag=false");
body CSS call:Code:<script type="text/javascript" src="dragAndDrop.js"></script>
IE 7 and 8 work fine, FF 3.5.14 and 3.6.13 do not work.Code:<img src="Images/colours/standard_colours/polar_white.png" alt="Polar White" width="114" height="75" class="dragme" />
appreciate the help and understanding,
thanks,
Tin



Reply With Quote


Bookmarks