diff --git a/dist/tribute.js b/dist/tribute.js index 64ddcb35..be2b1f5c 100644 --- a/dist/tribute.js +++ b/dist/tribute.js @@ -858,9 +858,12 @@ if (!Array.prototype.find) { div.appendChild(span); var rect = element.getBoundingClientRect(); + var doc = document.documentElement; + var windowLeft = (window.pageXOffset || doc.scrollLeft) - (doc.clientLeft || 0); + var windowTop = (window.pageYOffset || doc.scrollTop) - (doc.clientTop || 0); var coordinates = { - top: rect.top + span.offsetTop + parseInt(computed.borderTopWidth) + parseInt(computed.fontSize), - left: rect.left + span.offsetLeft + parseInt(computed.borderLeftWidth) + top: rect.top + windowTop + span.offsetTop + parseInt(computed.borderTopWidth) + parseInt(computed.fontSize), + left: rect.left + windowLeft + span.offsetLeft + parseInt(computed.borderLeftWidth) }; this.getDocument().body.removeChild(div); diff --git a/js/tribute.js b/js/tribute.js index 80b1d327..b2fb7e17 100644 --- a/js/tribute.js +++ b/js/tribute.js @@ -781,9 +781,12 @@ if (!Array.prototype.find) { div.appendChild(span) let rect = element.getBoundingClientRect() + var doc = document.documentElement; + var windowLeft = (window.pageXOffset || doc.scrollLeft) - (doc.clientLeft || 0); + var windowTop = (window.pageYOffset || doc.scrollTop) - (doc.clientTop || 0); let coordinates = { - top: rect.top + span.offsetTop + parseInt(computed.borderTopWidth) + parseInt(computed.fontSize), - left: rect.left + span.offsetLeft + parseInt(computed.borderLeftWidth) + top: rect.top + windowTop + span.offsetTop + parseInt(computed.borderTopWidth) + parseInt(computed.fontSize), + left: rect.left + windowLeft + span.offsetLeft + parseInt(computed.borderLeftWidth) } this.getDocument().body.removeChild(div)