Skip to content

Commit 6c731f4

Browse files
committed
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.
1 parent e51e7a6 commit 6c731f4

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

select2.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1179,7 +1179,7 @@ the specific language governing permissions and limitations under the Apache Lic
11791179
dropTop = offset.top + height,
11801180
dropLeft = offset.left,
11811181
enoughRoomBelow = dropTop + dropHeight <= viewportBottom,
1182-
enoughRoomAbove = (offset.top - dropHeight) >= this.body().scrollTop(),
1182+
enoughRoomAbove = (offset.top - dropHeight) >= $window.scrollTop(),
11831183
dropWidth = $dropdown.outerWidth(false),
11841184
enoughRoomOnRight = dropLeft + dropWidth <= viewPortRight,
11851185
aboveNow = $dropdown.hasClass("select2-drop-above"),

0 commit comments

Comments
 (0)