Image move script not working in firefox

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • chris1606
    New Member
    • Oct 2006
    • 3

    Image move script not working in firefox

    This script floats one image over another (to conterract transparency). It works fine in Opera and Internet Explorer, but the image won't move in firefox. Any ideas how I can get it to work please?

    Code:
    function move() {
    	var curleft = curtop = 0;
    	var obj = document.getElementById('pic1');
    	if (obj.offsetParent) {
    		curleft = obj.offsetLeft;
    		curtop = obj.offsetTop;
    		while (obj = obj.offsetParent) {
    			curleft += obj.offsetLeft;
    			curtop += obj.offsetTop;
    		}
    	}
    	
    	document.getElementById('pic2').style.pixelTop = curtop;
    	document.getElementById('pic2').style.pixelLeft = curleft;
    }
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    pixelTop/Left are not supported in Firefox. Use top/left instead.

    Comment

    Working...