Add partystreusel to your Gemfile gem 'partystreusel'
and bundle. Done.
- Expandable Content: enables a "read more" button to show or hide additional content.
- Accordion: Allows for multiple nested accordions.
Most components have a backbone.js dependency. Satisfy it by loading backbone.js:
gem 'rails-backbone'
Then, require backbone.js and underscore.js in your manifest, usually application.js(.coffee):
#= require underscore
#= require backbone
Load it inside your manifest, usually application.js(.coffee):
#= require sc.expandable_content
#jump_id.expandable
… your content …
%a.more{ :href => '#' } read more
.expandable-content.hidden
… read more content …
%a.less{ :href => '#jump_id' } read less
.hidden
display: none
$(".expandable").each ->
new SC.ExpandableContent(el: $(this))
Load it inside your manifest, usually application.js(.coffee):
#= require sc.accordion
.accordion
.accordion-item
.title
The clickable header of the accordion item
.content
… The content which is toggled by clicking the header …
.open .content
display: block
.content
display: none
$(".accordion").each ->
new SC.Accordion(el: $(this))