diff --git a/select2.js b/select2.js index ed1683e7..4ebd445a 100755 --- a/select2.js +++ b/select2.js @@ -717,7 +717,7 @@ height = this.container.outerHeight(), width = this.container.outerWidth(), dropHeight = this.dropdown.outerHeight(), - viewportBottom = document.body.scrollTop + document.documentElement.clientHeight, + viewportBottom = $(window).scrollTop() + document.documentElement.clientHeight, dropTop = offset.top + height, enoughRoomBelow = dropTop + dropHeight <= viewportBottom, enoughRoomAbove = (offset.top - dropHeight) >= document.body.scrollTop,