Make sure dropdowns don't go above the edge of the screen

This commit is contained in:
Toby Zerner 2017-11-05 16:17:50 +10:30
parent a6553954e2
commit 9682cd5f26

View File

@ -69,6 +69,10 @@ export default class Dropdown extends Component {
$menu.offset().top + $menu.height() > $(window).scrollTop() + $(window).height()
);
if ($menu.offset().top < 0) {
$menu.removeClass('Dropdown-menu--top');
}
$menu.toggleClass(
'Dropdown-menu--right',
isRight || $menu.offset().left + $menu.width() > $(window).scrollLeft() + $(window).width()