私は初めて twitter ブーストラップを使用しており、折りたたみ可能なアコーディオンを使用しています。
ページが読み込まれると、最初のアイテムがデフォルトで開かれ、残りのアイテムはすべて折りたたまれます。
ページが読み込まれると、デフォルトで 2 番目のアイテムが開かれ、最初のアイテムと残りのアイテムが折りたたまれます。
これを達成する簡単な方法はありますか?属性をいじってみましたdata-toggle
が、どこにも行きません。
<div class="accordion" id="accordion2">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#collapseOne">
Name & Location
</a>
</div>
<div id="collapseOne" class="accordion-body collapse in">
<div class="accordion-inner">
<%= f.input :name %> <br/>
<%= f.input :addr_1, label: 'Address' %> <br/>
<%= f.input :addr_2, label: false %> <br/>
<%= f.input :addr_3, label: false, placeholder: "County, State, Provence, Region etc" %> <br/>
<%= f.input :country, label: false, :priority => [ "Ireland", "United Kingdom" ] %> <br/>
</div>
</div>
</div>
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#collapseTwo">
Description
</a>
</div>
<div id="collapseTwo" class="accordion-body collapse">
<div class="accordion-inner">
<%= f.input :description, :input_html => { :cols => 10, :rows => 3 } %> <br/>
<%= f.input :looped, :as => :boolean %>
<%= f.input :duration_hours, :label => 'Duration', :collection => 0..12, :include_blank => false, :hint => "hours" %>
<%= f.input :duration_mins, collection: [ 0, 15, 30, 45 ], :include_blank => false, label: false, :hint => "mins" %>
</div>
</div>
</div>
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#collapseThree">
Images
</a>
</div>
<div id="collapseThree" class="accordion-body collapse">
<div class="accordion-inner">
<%= f.simple_fields_for :photos do |builder| %>
<%= render 'photo_fields', f: builder %>
<% end %>
<div style=clear:both;> </div>
<%= link_to_add_fields "Add More", f, :photos %>
</div>
</div>
</div>
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#collapseFour">
Route
</a>
</div>
<div id="collapseFour" class="accordion-body collapse">
<div class="accordion-inner">
<%= f.simple_fields_for :routes do |builder| %>
<%= render 'route_fields', f: builder %>
<% end %>
<%= link_to_add_fields "Add Step", f, :routes %>
</div>
</div>
</div>
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#collapseFive">
Directions
</a>
</div>
<div id="collapseFive" class="accordion-body collapse">
<div class="accordion-inner">
<%= f.simple_fields_for :directions do |builder| %>
<%= render 'direction_fields', f: builder %>
<% end %>
<%= link_to_add_fields "Add More Directions", f, :directions %>
</div>
</div>
</div>
</div>