From 6c731f4181e7b996642f0cef5461dc3d9cc8fe23 Mon Sep 17 00:00:00 2001 From: Diogo Trentini Date: Thu, 20 Mar 2014 21:45:41 -0300 Subject: [PATCH] Fix method to get space above the dropdown It's better to get the scrollTop value from window rather than body to update enoughRoomAbove variable. This method is supported by the main browsers. --- select2.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/select2.js b/select2.js index eabc25ee..bece133a 100644 --- a/select2.js +++ b/select2.js @@ -1179,7 +1179,7 @@ the specific language governing permissions and limitations under the Apache Lic dropTop = offset.top + height, dropLeft = offset.left, enoughRoomBelow = dropTop + dropHeight <= viewportBottom, - enoughRoomAbove = (offset.top - dropHeight) >= this.body().scrollTop(), + enoughRoomAbove = (offset.top - dropHeight) >= $window.scrollTop(), dropWidth = $dropdown.outerWidth(false), enoughRoomOnRight = dropLeft + dropWidth <= viewPortRight, aboveNow = $dropdown.hasClass("select2-drop-above"),