1

所以我有引导折叠,在里面我有标签,在其中一个标签里面我有一个带有 text_field 的表单,它有引导输入,问题是输入的下拉菜单不会超过折叠。

具有自动完成功能的 text_field 是其中的最后一个元素。

这是图片

我希望下拉菜单在折叠元素下方展开(在图片上的线条下方)

编辑:这是该视图的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' 是我要询问的带有自​​动完成功能的字段。

编辑:

这是呈现的 HTML

4

3 回答 3

1

我以某种方式找到堆栈溢出的答案,解决方案是

.accordion-body.in { 溢出:可见;}

它来自这里

我很抱歉提出已经有答案的问题,但我真的找不到它,因为我没有猜到正确的搜索词。

于 2013-07-22T08:04:49.797 回答
1

应用以下 css 只能部分工作,accordion-body.in { overflow:visible; },因为它只显示正在展开的“切片”的溢出。您还需要将其应用于父级。另外上面的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");
    });
于 2014-04-08T14:50:36.100 回答
0

这对我有用,因为我的预输入在导航栏中

.navbar-collapse.in{
    /*allows typeahead to overflow nav bar during collapse*/
    overflow-y:initial !important;
}
于 2017-04-22T16:29:23.103 回答