Skip to content

Commit

Permalink
Merge pull request #1117 from /issues/1111@v2
Browse files Browse the repository at this point in the history
popup: Wrong popup position while BODY has offset (close #1111)
  • Loading branch information
dfilatov committed Nov 24, 2014
2 parents 8c9e862 + 3ab5065 commit ccc748d
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions common.blocks/popup/_target/popup_target_anchor.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ modules.define(
['i-bem__dom', 'jquery', 'objects', 'functions__throttle'],
function(provide, BEMDOM, $, objects, throttle, Popup) {

var UPDATE_TARGET_VISIBILITY_THROTTLING_INTERVAL = 100,
var body = $(BEMDOM.doc[0].body),
UPDATE_TARGET_VISIBILITY_THROTTLING_INTERVAL = 100,
undef;

/**
Expand Down Expand Up @@ -104,11 +105,12 @@ provide(Popup.decl({ modName : 'target', modVal : 'anchor' }, /** @lends popup.p
*/
_calcTargetDimensions : function() {
var anchor = this._anchor,
anchorPos = anchor.offset();
anchorOffset = anchor.offset(),
bodyOffset = body.offset();

return {
left : anchorPos.left,
top : anchorPos.top,
left : anchorOffset.left - bodyOffset.left,
top : anchorOffset.top - bodyOffset.top,
width : anchor.outerWidth(),
height : anchor.outerHeight()
};
Expand Down

0 comments on commit ccc748d

Please sign in to comment.