I ran into this issue as well today. The version 1.2 of Interface now
uses the getPosition() instead of the getPositionLite() for
calculating the position. The following code changes to the iutils.js
fixes issues if you're dragging from an element with a position of
"fixed".

Thanks to bander for the original fix. Can we get these fixes added to
Interface?

-Dan

getPosition : function(e)
{
        var x = 0;
        var y = 0;
        var restoreStyle = false;
        var es = e.style;
        if (jQuery(e).css('display') == 'none') {
                oldVisibility = es.visibility;
                oldPosition = es.position;
                es.visibility = 'hidden';
                es.display = 'block';
                es.position = 'absolute';
                restoreStyle = true;
        }
        var el = e, fixed = false;
        while (el){
                if (jQuery(el).css('position') == 'fixed') {
                        fixed = true;
                }
                x += el.offsetLeft + (el.currentStyle && !jQuery.browser.opera ?
parseInt(el.currentStyle.borderLeftWidth)||0:0);
                y += el.offsetTop + (el.currentStyle && !jQuery.browser.opera ?
parseInt(el.currentStyle.borderTopWidth)||0:0);
                el = el.offsetParent;
        }
        if (fixed) {
                if (window.pageXOffset != null) {
                        x += window.pageXOffset;
                        y += window.pageYOffset;
                } else {
                        x += document.body.scrollLeft;
                        y += document.body.scrollTop;
                }
        }
        el = e;
        while (el && el.tagName  && el.tagName.toLowerCase() != 'body')
        {
                x -= el.scrollLeft||0;
                y -= el.scrollTop||0;
                el = el.parentNode;
        }
        if (restoreStyle) {
                es.display = 'none';
                es.position = oldPosition;
                es.visibility = oldVisibility;
        }
        return {x:x, y:y};
},
getPositionLite : function(el)
{
        var x = 0, y = 0;
        var fixed;
        while(el) {
                if (jQuery(el).css('position') == 'fixed') {
                        fixed = true;
                }
                x += el.offsetLeft || 0;
                y += el.offsetTop || 0;
                el = el.offsetParent;
        }
        if (fixed) {
                if (window.pageXOffset != null) {
                        x += window.pageXOffset;
                        y += window.pageYOffset;
                } else {
                        x += document.body.scrollLeft;
                        y += document.body.scrollTop;
                }
        }
        return {x:x, y:y};
},

Reply via email to