Skip to content

Commit

Permalink
fix(dropdown): align position with or without vertical scrollbar
Browse files Browse the repository at this point in the history
  • Loading branch information
dolevd committed May 24, 2016
1 parent 13c14af commit f838eb6
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/dropdown/dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,8 @@ angular.module('ui.bootstrap.dropdown', ['ui.bootstrap.position'])
var pos = $position.positionElements($element, self.dropdownMenu, 'bottom-left', true),
css,
rightalign,
scrollbarWidth;
scrollbarPadding,
scrollbarWidth = 0;

css = {
top: pos.top + 'px',
Expand All @@ -205,7 +206,12 @@ angular.module('ui.bootstrap.dropdown', ['ui.bootstrap.position'])
css.right = 'auto';
} else {
css.left = 'auto';
scrollbarWidth = $position.scrollbarWidth(true);
scrollbarPadding = $position.scrollbarPadding(appendTo);

if (scrollbarPadding.heightOverflow && scrollbarPadding.scrollbarWidth) {
scrollbarWidth = scrollbarPadding.scrollbarWidth;
}

css.right = window.innerWidth - scrollbarWidth -
(pos.left + $element.prop('offsetWidth')) + 'px';
}
Expand Down

0 comments on commit f838eb6

Please sign in to comment.