diff --git a/js/views/listView.js b/js/views/listView.js index 1136baab0f..48f5534baa 100644 --- a/js/views/listView.js +++ b/js/views/listView.js @@ -186,6 +186,15 @@ this.el = opts.el; this.scrollEl = opts.scrollEl; this.scrollView = opts.scrollView; + // Get the True Top of the list el http://www.quirksmode.org/js/findpos.html + this.listEl.trueTop = 0; + if (this.listEl.offsetParent) { + var obj = this.listEl; + do { + this.listEl.trueTop += obj.offsetTop; + obj = obj.offsetParent; + } while (obj); + } }; ReorderDrag.prototype = new DragOp(); @@ -193,9 +202,8 @@ ReorderDrag.prototype._moveElement = function(e) { var y = e.gesture.center.pageY + this.scrollView.getValues().top - - this.scrollView.__container.offsetTop - (this._currentDrag.elementHeight / 2) - - this.listEl.offsetTop; + this.listEl.trueTop; this.el.style[ionic.CSS.TRANSFORM] = 'translate3d(0, '+y+'px, 0)'; }; @@ -231,7 +239,7 @@ var scrollY = 0; var pageY = e.gesture.center.pageY; - var offset = this.listEl.offsetTop + this.scrollView.__container.offsetTop; + var offset = this.listEl.trueTop; //If we have a scrollView, check scroll boundaries for dragged element and scroll if necessary if (this.scrollView) {