Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

Commit

Permalink
fix(tooltip): fix positioning inside scrolling element
Browse files Browse the repository at this point in the history
Closes #533
  • Loading branch information
pkozlowski-opensource committed Jul 13, 2013
1 parent 360cd5c commit 63ae7e1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/position/position.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
10 changes: 10 additions & 0 deletions src/position/test/test.html
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,16 @@ <h3>Within absolute-positioned DIV</h3>
<div class="content" position>Content</div>
</div>

<h3>Within overflowing absolute-positioned DIV</h3>
<div class="container" style="height: 50px; overflow: scroll;overflow-x: hidden; position: absolute;">
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.
<div class="content" position>Content</div>
</div>

<br>
<br>
<br>

<h3>Next to a float element</h3>

<div class="container">
Expand Down

0 comments on commit 63ae7e1

Please sign in to comment.