6.0.3 • Published 6 months ago

@wearediagram/wsol.accordion v6.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

Accordion

Content accordions that toggle content when clicked.

Installation

Install via Bower:

$ bower install websolutions/accordion --save

Usage

The most basic example follows this DOM structure:

<div class="accordion">
  <div class="item">
    <h3 class="header sprite-container">Accordion Item #1</h3>
    <div class="info">Teaser text.</div>
    <div class="more">
      <p>Accordion Content</p>
    </div>
  </div>
  <div class="item">
    <h3 class="header sprite-container">Accordion Item #2</h3>
    <div class="info">Teaser text.</div>
    <div class="more">
      <p>Accordion Content</p>
    </div>
  </div>
</div>

And is initialized like so:

$(".accordion").wsol_accordion()

Configuring

The jQuery plugin supports a number of configuration options:

OptionTypeDescriptionDefault
itemSelectorStringSelector for accordion items.item
headerSelectorStringSelector for clickable header.header
bodySelectorStringSelector for content that will toggle.more
autoCollapseBooleanOther accordion items should close when one is openedtrue
openClassStringClass name to apply when the accordion is openedopen
closeClassStringClass name to apply when the accordion is closedclose
startCollapsedBooleanThe accordion should be collapsed initiallytrue
startFirstOpenBooleanIf the accordion should start collapsed, keep the first item openfalse
spriteContainerStringSelector for the sprite container.sprite-container
spriteClassStringClass name to apply to the sprite elementtoggle-sprite
customSpriteFunctionFunction to rebuild sprite contents
toggleSpeedIntegerAnimation length (ms)500
beforeOpenFunctionFunction called before the accordion item is openednull
beforeCloseFunctionFunction called before the accordion item is closednull
afterOpenFunctionFunction called after the accordion item is openednull
afterCloseFunctionFunction called after the accordion item is closednull
6.0.3

6 months ago

5.0.0

2 years ago

6.0.1

2 years ago

6.0.0

2 years ago

6.0.2

1 year ago

4.1.3

2 years ago

4.1.2

2 years ago

4.1.1

2 years ago

4.1.0

2 years ago