From 0538bdcfa6d4aecf21318f6ef07d2116df07a307 Mon Sep 17 00:00:00 2001 From: Igor Vaynberg Date: Tue, 10 Jul 2012 08:10:52 +0300 Subject: [PATCH] reposition the dropdown whenever results are changed. this is in preparation for open-on-top issue #197 --- select2.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/select2.js b/select2.js index ac9d31a1..b0aebd19 100755 --- a/select2.js +++ b/select2.js @@ -726,14 +726,15 @@ // abstract positionDropdown: function() { - var offset = this.container.offset(); - var height = this.container.outerHeight(); - var width = this.container.outerWidth(); - var css = { + var offset = this.container.offset(), + height = this.container.outerHeight(), + width = this.container.outerWidth(), + css = { top: offset.top + height, left: offset.left, width: width - } + }; + this.dropdown.css(css); }, @@ -915,6 +916,7 @@ } else { more.remove(); } + self.positionDropdown(); self.resultsPage = page; })}); } @@ -937,6 +939,7 @@ function postRender() { results.scrollTop(0); search.removeClass("select2-active"); + self.positionDropdown(); } function render(html) {