Подтвердить что ты не робот

Typeahead.js вмешивается в группы ввода Bootstrap

Как мне заставить Typeahead.js разделять мои входные группы Twitter Bootstrap 3? Всякий раз, когда я указываю javascript Typeahead в текстовой области, входящей в состав группы ввода, объединенная текстовая область и кнопка отправки останавливаются. Это что-то, что просто ошибка в Typeahead, или есть обходное решение для этого?

Без загрузки Typeahead.JS:

enter image description here

С Typeahead.JS:

enter image description here

Мой оригинальный HTML:

    <div class="col-sm-4 hidden-xs">
    <form class="navbar-form" role="search">
        <div class="input-group">
        <input type="text" id="tags" class="form-control" name="q">
            <div class="input-group-btn">
                <button class="btn btn-default" type="submit">Search</button>
            </div>
        </div>
    </form> 
    </div>

Это то, что Typeahead делает с этим HTML:

<div class="col-sm-4 hidden-xs">
        <form class="navbar-form" role="search">
            <div class="input-group">
            <span class="twitter-typeahead" style="position: relative; display: inline-block;">
            <input type="text" class="form-control tt-hint" disabled="" autocomplete="off" spellcheck="false" style="position: absolute; top: 0px; left: 0px; border-color: transparent; box-shadow: none; background-attachment: scroll; background-clip: border-box; background-color: rgb(255, 255, 255); background-image: none; background-origin: padding-box; background-size: auto; background-position: 0% 0%; background-repeat: repeat repeat;">
            <input type="text" id="tags" class="form-control tt-input" name="q" autocomplete="off" spellcheck="false" dir="auto" style="position: relative; vertical-align: top; background-color: transparent;">
            <pre aria-hidden="true" style="position: absolute; visibility: hidden; white-space: nowrap; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; word-spacing: 0px; letter-spacing: 0px; text-indent: 0px; text-rendering: auto; text-transform: none;">
            </pre>
            <span class="tt-dropdown-menu" style="position: absolute; top: 100%; left: 0px; z-index: 100; display: none;"><div class="tt-dataset-0"></div>
            </span>
            </span>
                <div class="input-group-btn">
                    <button class="btn btn-default" type="submit">Search</button>
                </div>
            </div>
        </form> 
        </div>
4b9b3361

Ответ 1

Этот проект частично решил проблему для меня: https://github.com/hyspace/typeahead.js-bootstrap3.less

Единственная проблема заключается в том, что когда я применяю теневой эффект для обоих .btn и .form-control, тень рисуется также между полем ввода и кнопкой.

enter image description here

Ответ 2

.twitter-typeahead{ float:left; width:100%}

Ответ 3

Это устраняет проблему, если левая часть текстового поля квадратная (не округленная):

.input-group .twitter-typeahead .form-control:not(:first-child):not(:last-child) {
  border-radius: 4px 0px 0px 4px;
}

Ответ 4

может быть?

.twitter-typeahead > .form-control{ width: inherit !important; }

Ответ 5

Решение Bootstrap v4:

.input-group > .twitter-typeahead {
   flex: 1 1 auto;
   width: auto;
}