2016-07-30 57 views
0

select2-3.5.2工作正常。但只要我升级到4.0.3它突然出现在页面的左侧。我正在使用jQuery UI,希望这两个能够很好地一起玩。select2对齐方式不起作用

float:right;正在对select2-4.0.3

<div style="position:absolute; top:0px; left:0px; width:100%" class="ui-widget infobar-wrapper"> 
     <div name="ibar1" id="ibar1" class="ui-widget-header infobar"> 
      <select name="themes" id="themes" style="float:right;"> <!--margin-top:-3px;--> 
       <option></option> 
       <option value="black-tie">black-tie</option> 
       <option value="trontastic">trontastic</option> 
       <option value="ui-darkness">ui-darkness</option> 
       <option value="ui-lightness">ui-lightness</option> 
      </select> 
     </div> 
    </div> 

没有影响,因为我这样做的JS:

$("#themes").select2({dropdownAutoWidth:true,placeholder:'Change theme'}); 

CSS:

.infobar { 
    height:27px; 
    font-weight:bold; 
    overflow:hidden; 
    border:0px; 
} 

回答

1

出现,但它也出现在float应该移到另一个项目。

CSS

.infobar { 
    height: 27px; 
    font-weight: bold; 
    overflow: hidden; 
    border: 0px; 
} 

.infobar .select2-container { 
    float: right; 
} 

工作实例:https://jsfiddle.net/Twisty/Lq7q5xxj/

+0

谢谢。我不知道有什么像.select2-container ... – rajeev