所以我有引导崩溃,在其中我有标签,并且在其中一个标签中我有一个带有text_field的表单,其中包含bootstrap typeahead,问题是typeahead的下拉列表不会在崩溃时展开。
具有自动填充功能的text_field是其中的最后一个元素。
这是picture。
我希望下拉列表在展开元素下方(图片中的线下方)展开
修改: 这是该视图的haml
- @i = 0
- @trainings.each do |training|
- @i = @i+1
.accordion#accordion2
.accordion-group
.accordion-heading
%a{:class => 'accordion-toggle', 'data-toggle' => 'collapse', :href => "#collapse#{@i}"}
= "Training #{@i}"
%div{:id => "collapse#{@i}", :class => 'accordion-body collapse'}
.accordion-inner
%pre= "Description: #{training.description}"
%ul.nav.nav-tabs#myTab
%li.active
%a{"data-toggle" => "tab", :href => "#planirano#{@i}"} Planirano
%li
%a{"data-toggle" => "tab", :href => "#napravljeno#{@i}"} Napravljeno
.tab-content
%div{:class => 'tab-pane active', :id => "planirano#{@i}"}
- training.exercises.each do |exercise|
%pre= "#{exercise.element.name} | #{exercise.description} | #{exercise.number_of_series}"
= form_for :training_exercise, :url => training_exercises_path(:training => training.id), remote: true, html: {:class => 'form-inline'} do |f|
= f.label :exercise
= f.text_field :exercise, :id => 'add_training_exercise'
= f.button :Add, :class => 'btn'
%div{:class => 'tab-pane', :id => "napravljeno#{@i}"} to sam napravio
f.text_ifeld:exercise,:id => 'add_training_exercise'是我要问的自动填充字段。
修改
答案 0 :(得分:1)
我以某种方式找到堆栈溢出的答案,解决方案是
.accordion-body.in {溢出:可见; } 强>
来自here。
我很抱歉提出已经有答案的问题,但我真的无法找到它,因为我没有猜到正确的搜索词。
答案 1 :(得分:1)
应用以下css只能部分工作,accordion-body.in {overflow:visible;因为它只显示" slice"的溢出。正在扩大。您也需要将其应用于父母。另外上面的css影响扩展/倒塌效果;即所显示的内容在手风琴上显示,而不是逐渐显示。我尝试的解决方案是:
1. Apply the overflow:visible only to the parent, i.e. #myAccordion { overflow:visible } AND
2. Apply overflow:visible only to the "slice" being opened when it is needed (on open), and removing it on close, like so:
$("#myAccordion").collapse();
// Here, we are attaching event handlers to the accordion "slice" body so that we can update it's overflow when opened AND when it's about to be closed.
$("#myAccordion .accordion-body").on("shown", function () {
$(this).css("overflow", "visible");
});
$("#myAccordion .accordion-body").on("hide", function () {
$(this).css("overflow", "hidden");
});
答案 2 :(得分:0)
这对我有用,因为我的预先输入是在导航栏中
.navbar-collapse.in{
/*allows typeahead to overflow nav bar during collapse*/
overflow-y:initial !important;
}