Przeglądaj źródła

Merge pull request #1891 from jfisheratwork/master

Fix for collision detection regarding enoughRoomOnRight and css border top for drop-auto-width
Igor Vaynberg 11 lat temu
rodzic
commit
356984d8fe
2 zmienionych plików z 10 dodań i 11 usunięć
  1. 9 10
      select2.css
  2. 1 1
      select2.js

+ 9 - 10
select2.css

@@ -18,7 +18,6 @@ Version: @@ver@@ Timestamp: @@timestamp@@
   /*
     Force border-box so that % widths fit the parent
     container without overlap because of margin/padding.
-
     More Info : http://www.quirksmode.org/css/box.html
   */
   -webkit-box-sizing: border-box; /* webkit */
@@ -145,15 +144,6 @@ Version: @@ver@@ Timestamp: @@timestamp@@
             box-shadow: 0 4px 5px rgba(0, 0, 0, .15);
 }
 
-.select2-drop-auto-width {
-    border-top: 1px solid #aaa;
-    width: auto;
-}
-
-.select2-drop-auto-width .select2-search {
-    padding-top: 4px;
-}
-
 .select2-drop.select2-drop-above {
     margin-top: 1px;
     border-top: 1px solid #aaa;
@@ -174,6 +164,15 @@ Version: @@ver@@ Timestamp: @@timestamp@@
     border-top: 1px solid #5897fb;
 }
 
+.select2-drop-auto-width {
+    border-top: 1px solid #aaa;
+    width: auto;
+}
+
+.select2-drop-auto-width .select2-search {
+    padding-top: 4px;
+}
+
 .select2-container .select2-choice .select2-arrow {
     display: inline-block;
     width: 18px;

+ 1 - 1
select2.js

@@ -1208,7 +1208,7 @@ the specific language governing permissions and limitations under the Apache Lic
             }
 
             if (!enoughRoomOnRight) {
-               dropLeft = offset.left + width - dropWidth;
+               dropLeft -= (dropLeft + dropWidth) - viewPortRight;
             }
 
             css =  {