Преглед на файлове

* Fix of issue 550 Select2 and CSS Transforms: dropdown menu is off position: https://github.com/ivaynberg/select2/issues/550

jquery offset() returns incorrect value when ancestor container has css transform applied to it, causing dropdown to appear in incorrect position.

Using { top: variable.offsetTop, left: variable.offsetLeft } instead of variable.offset() fixes this issue

Signed-off-by: Igor Vaynberg <[email protected]>
Bob Burton преди 12 години
родител
ревизия
ef8c49f85f
променени са 1 файла, в които са добавени 1 реда и са изтрити 1 реда
  1. 1 1
      select2.js

+ 1 - 1
select2.js

@@ -976,7 +976,7 @@ the specific language governing permissions and limitations under the Apache Lic
 
         // abstract
         positionDropdown: function() {
-            var offset = this.container.offset(),
+            var offset = { top: this.container[0].offsetTop, left: this.container[0].offsetLeft },
                 height = this.container.outerHeight(false),
                 width = this.container.outerWidth(false),
                 dropHeight = this.dropdown.outerHeight(false),