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 257ee936f4
commit 3be98b9f8e

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()