CSS issue on Twitter Typeahead with Bootstrap 3

前端 未结 14 924
醉话见心
醉话见心 2020-11-30 22:17

With the release of Bootstrap 3. Typeahead has been removed in favor of this:
https://github.com/twitter/typeahead.js

Ive integrated it successfully on remote fe

14条回答
  •  失恋的感觉
    2020-11-30 23:08

    EDIT: Updated for Bootstrap 3.0 EDIT 2: Typeahead call was modified. See new jsfiddle

    After playing around with the styling it looks like the form-control class doesn't quite line-up with the tt-hint. So I made sure the margins and borders line up. Taking Hieu Nguyen's answer and adding border-radius and support for input-small/input-large

    CSS

    .twitter-typeahead .tt-hint
    {
        display: block;
        height: 34px;
        padding: 6px 12px;
        font-size: 14px;
        line-height: 1.428571429;
        border: 1px solid transparent;
        border-radius:4px;
    }
    
    .twitter-typeahead .hint-small
    {
        height: 30px;
        padding: 5px 10px;
        font-size: 12px;
        border-radius: 3px;
        line-height: 1.5;
    }
    
    .twitter-typeahead .hint-large
    {
        height: 45px;
        padding: 10px 16px;
        font-size: 18px;
        border-radius: 6px;
        line-height: 1.33;
    }
    

    Script for input-small/input-large

    $('.typeahead.input-sm').siblings('input.tt-hint').addClass('hint-small');
    $('.typeahead.input-lg').siblings('input.tt-hint').addClass('hint-large');
    

    Updated jsfiddle: http://jsfiddle.net/KrtB5/542/

提交回复
热议问题