【问题标题】:select2 alignment not workingselect2对齐不起作用
【发布时间】:2016-07-30 23:29:27
【问题描述】:

select2-3.5.2 工作正常。但是一旦我升级到 4.0.3,它就会突然出现在页面的左侧。我正在使用jquery-UI,希望这两个能很好地配合使用。

浮动:右;对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;
}

【问题讨论】:

    标签: javascript jquery jquery-ui select2


    【解决方案1】:

    出现,但似乎 float 应该移动到另一个项目。

    CSS

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

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

    【讨论】:

    • 谢谢。我不知道有类似 .select2-container...
    猜你喜欢
    • 2016-11-07
    • 2011-07-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多