2016-07-11 22 views
0

Ich habe Probleme, select2 mit meinem Wrapbootstrap (Inspinia) Thema zu arbeiten.Select2 funktioniert nicht mit modal

Die Optionen erscheinen "unter" meinem Modal, wodurch sie nicht auswählbar sind (siehe Abbildung unten). Ich denke, Select2 erzeugt eine Reihe von Wrappern, die in die Quere kommen. Wie behebe ich das? Als ich das Element untersuchen, ist es das, was ich sehe:

<div class="form-group"> 
    <label>Variant SKU</label> 
    <select name="variant_sku_id" id="variant_sku_id" class="variant_sku_id form-control select2-hidden-accessible" tabindex="-1" aria-hidden="true"> 
    <option value="1">option1</option> 
    <option value="2">option2</option> 
    </select> 
    <span class="select2 select2-container select2-container--default select2-container--below select2-container--open" dir="ltr" style="width: 100px;"> 
    <span class="selection"> 
    <span class="select2-selection select2-selection--single" role="combobox" aria-haspopup="true" aria-expanded="true" tabindex="0" aria-labelledby="select2-variant_sku_id-container" aria-owns="select2-variant_sku_id-results" aria-activedescendant="select2-variant_sku_id-result-3g9n-1"> 
    <span class="select2-selection__rendered" id="select2-variant_sku_id-container" title="option1"</span> 
    <span class="select2-selection__arrow" role="presentation"><b role="presentation"></b></span> 
    </span> 
    </span> 
    <span class="dropdown-wrapper" aria-hidden="true"></span> 
    </span> 
</div> 

Select2 not working with modal

Antwort

2

Fest durch diese Option hinzugefügt, wenn select2 Initialisierung:

dropdownParent: $(".modal-body") 
0

Sie den Z-Index für select2 ändern kann. Das sollte auch funktionieren:

.select2 { z-index: 99999999; }