Difficulty with selectize.js dropdown overflow in mobile

巧了我就是萌 提交于 2019-12-08 03:39:49

问题


So I'm creating an autocomplete search field using selectize.js. It works fantastically, unless I scale the dropdown to a small mobile screen. Any text mildly long causes it to overflow to the next line and stretch the dropdown element farther to the right that it should. In addition to the textbox growing, the icon next to the textbox grows with it.

Here is a jsfiddle demonstrating the problem. If you drag the screen so that the 'Result' section is very small, you can see the overflow. On my website, it not only overflows but also stretches the box to the right.

One would think that the ideal property to work with would be 'overflow', making it hidden..but this doesn't seem to work.

Is there any way to fix this?

jsfiddle: http://jsfiddle.net/Eq6cJ/

HTML:

<select id = "searchTextbox">
    <option value = "aaaa"> bbbbbbbbbbbbbbbb </option>
    <option value = "cccc"> dddd </option> 
</select>

Javascript:

var $select = $('#searchTextbox').selectize({
              maxItems: 1,
              maxOptions: 5,
              searchField: ['text', 'value'],
              openOnFocus: false,
              highlight: false,
              scrollDuration: 300,
              create: false
          });

回答1:


.selectize-input {
   white-space: nowrap;
}

JSFIDDLE




回答2:


.selectize-input .item {
  width: 110px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-top: 5px !important;
}


来源:https://stackoverflow.com/questions/24121032/difficulty-with-selectize-js-dropdown-overflow-in-mobile

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!