瀏覽代碼

tweak dropdown position. fixes #228

Igor Vaynberg 13 年之前
父節點
當前提交
1fc09825ed
共有 1 個文件被更改,包括 4 次插入5 次删除
  1. 4 5
      select2.js

+ 4 - 5
select2.js

@@ -828,8 +828,10 @@
 
 
             this.dropdown.show();
             this.dropdown.show();
             this.ensureHighlightVisible();
             this.ensureHighlightVisible();
-            this.focusSearch();
 
 
+            this.positionDropdown();
+
+            this.focusSearch();
         },
         },
 
 
         // abstract
         // abstract
@@ -997,7 +999,7 @@
             function postRender() {
             function postRender() {
                 results.scrollTop(0);
                 results.scrollTop(0);
                 search.removeClass("select2-active");
                 search.removeClass("select2-active");
-                self.positionDropdown();
+                if (initial !== true) self.positionDropdown();
             }
             }
 
 
             function render(html) {
             function render(html) {
@@ -1010,9 +1012,6 @@
                 return;
                 return;
             }
             }
 
 
-            // position dropdown before making a potentially long request
-            this.positionDropdown();
-
             this.resultsPage = 1;
             this.resultsPage = 1;
             opts.query({
             opts.query({
                     term: search.val(),
                     term: search.val(),