From 63ae7e122db6a3e4b6a7174b2e749a0802e069e0 Mon Sep 17 00:00:00 2001 From: Pawel Kozlowski Date: Sat, 13 Jul 2013 17:59:23 +0200 Subject: [PATCH] fix(tooltip): fix positioning inside scrolling element Closes #533 --- src/position/position.js | 4 ++-- src/position/test/test.html | 10 ++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/position/position.js b/src/position/position.js index bfda14711b..727a85e85d 100644 --- a/src/position/position.js +++ b/src/position/position.js @@ -57,8 +57,8 @@ angular.module('ui.bootstrap.position', []) var offsetParentEl = parentOffsetEl(element[0]); if (offsetParentEl != $document[0]) { offsetParentBCR = this.offset(angular.element(offsetParentEl)); - offsetParentBCR.top += offsetParentEl.clientTop; - offsetParentBCR.left += offsetParentEl.clientLeft; + offsetParentBCR.top += offsetParentEl.clientTop - offsetParentEl.scrollTop; + offsetParentBCR.left += offsetParentEl.clientLeft - offsetParentEl.scrollLeft; } return { diff --git a/src/position/test/test.html b/src/position/test/test.html index 5076e9b30c..0ea75acc6a 100644 --- a/src/position/test/test.html +++ b/src/position/test/test.html @@ -71,6 +71,16 @@

Within absolute-positioned DIV

Content
+

Within overflowing absolute-positioned DIV

+
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur non velit nulla. Suspendisse sit amet tempus diam. Sed at ultricies neque. Suspendisse id felis a sem placerat ornare. Donec auctor, purus at molestie tempor, arcu enim molestie lacus, ac imperdiet massa urna eu massa. Praesent velit tellus, scelerisque a fermentum ut, ornare in diam. Phasellus egestas molestie feugiat. Vivamus sit amet viverra metus. +
Content
+
+ +
+
+
+

Next to a float element