【问题标题】:typeahead on bootstrap 3在引导程序 3 上预先输入
【发布时间】:2014-04-21 07:14:28
【问题描述】:

目前我正在使用this typeahead,但它显示如下:

是否可以显示预输入,宽度与input 相同?

到目前为止我尝试的是:

.dropdown-menu {    
    display: block; position: static; width: 100%; 
}

但这会破坏较低的字段

查看我的fiddle

更新:

我尝试了@neel shah 和@shin 解决方案,这就是结果。我不知道为什么小提琴不是这样看的

【问题讨论】:

    标签: css twitter-bootstrap bootstrap-typeahead


    【解决方案1】:

    试试this。希望对您有所帮助。

    .dropdown-menu { width: 100%; }
    

    更新: 签出this

    【讨论】:

    【解决方案2】:

    问题在于position: static,您只需将其从 css 中删除即可

    检查这个FIDDLE

    .dropdown-menu { display: block; width: 100%; }
    

    【讨论】:

      【解决方案3】:
      $('.typeahead').typeahead({})
      on('typeahead:opened',function(){$('.dropdown-menu').css('width',$('.typeahead').width() + 'px');});
      

      【讨论】:

      • 我用这段代码$('#itemLaborCode').typeahead({name: 'example',source: ['item1','item2','item3','item4','item5','item6']}).on('typeahead:opened',function(){$('.dropdown-menu').css('width',$('#itemLaborCode').width() + 'px'); }); 试过了,但还是不行
      • 事件没有触发我测试过。能详细点吗?
      • $('.typeahead').typeahead({ remote: 'path/to/url' }).on('typeahead:opened',function(){$('.dropdown-menu ').css('width',$(this).width() + 'px');});
      • 签出this。我更新了我的小提琴事件没有触发。
      • 您是否在使用带有新 Bloodhound 建议引擎的“旧”Twitter Bootstrap 2 插件:github.com/bassjobsen/Bootstrap-3-Typeahead/issues/26
      猜你喜欢
      • 2013-08-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多