## Examples

#### Item 1

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem.

#### Item 2

#### Nested Item

Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo.

    $('.example').beefup();

### Open single

Open just one accordion at once. It is possible to choose one item that will not automatically close.

#### Item 1

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem.

#### Item 2

Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo.

#### Locked item

Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus.

    $('.example-opensingle').beefup({
        openSingle: true,
        stayOpen: 2
    });

### Animations

By default the accordion will slide down and up. It is possible to set the animation type to "slide", "fade" or leave empty "" and to define the open and the close animation speed.

#### Fade

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem.

    $('.example-fade').beefup({
        animation: 'fade',
        openSpeed: 400,
        closeSpeed: 400
    });

### Scroll

Scroll to the top of the open accordion. Use the property "scrollOffset" to add additional space or "scrollSpeed" to define the animation speed.

#### Item 1

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem.

#### Item 2

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem.

    $('.example-scroll').beefup({
        scroll: true,
        scrollOffset: -10
    });

### Self close

Close the accordion on click outside of the element.

#### Item

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem.

    $('.example-selfclose').beefup({
        selfClose: true
    });

### Hashchange

Use anchor links to open the accordion: #item

#### Item

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem.

    $('.example-hash').beefup({
        hash: true
    });

### Breakpoints

Change settings on different screen sizes.

#### Item 1

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem.

#### Item 2

Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo.

    $('.example-breakpoints').beefup({
        scroll: true,
        scrollOffset: -10,
        breakpoints: [
            {
                breakpoint: 768,
                settings: {
                    animation: 'fade',
                    scroll: false
                }
            },
            {
                breakpoint: 1024,
                settings: {
                    animation: 'slide',
                    openSpeed: 800,
                    openSingle: true
                }
            }
        ]
    });

## Advanced

### API Methods

Trigger open, close, click or scroll events.

#### Open

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem.

    var $beefup = $('.example-api').beefup();
    $beefup.open($('#beefup'));

### Callbacks

Also available are event driven callback methods on init, open and close.

#### Item

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem.

    $('.example-callbacks').beefup({
        onInit: function($el) {
            $el.css('border-color', 'blue');
        },
        onOpen: function($el) {
            $el.css('border-color', 'green');
        },
        onClose: function($el) {
            $el.css('border-color', 'red');
        }
    });

### HTML5 data attributes

Overwrite default options by using HTML5 data attributes.

#### Item

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem.

    $('.example-data').beefup();

    <article class="beefup example-data" data-beefup-options='{"animation": "", "openSpeed": 800}'>
        ...
    </article>

## Customize

### Tabs

- Tab 1
- Tab 2
- Tab 3

### Tab 1

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem.

### Tab 2

Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo.

### Tab 3

Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus.

    $('.tab__item').beefup({
        animation: '',
        openSingle: true,
        openSpeed: 0,
        closeSpeed: 0,
        onOpen: function($el) {
            // Add active class to tabs
            $('a[href="#' + $el.attr('id') + '"]').parent().addClass(this.openClass)
                    .siblings().removeClass(this.openClass);
        }
    });

    .tab__head {
      list-style: none;
      margin: 0 0 -1px;
      padding: 0;
    }

    .tab__head li {
      background: #fff;
      border: 1px solid #ddd;
      display: inline-block;
      font-weight: bold;
      z-index: 100;
    }

    .tab__head li.is-open {
      border-bottom-color: transparent;
    }

    .tab__head a {
      color: inherit;
      display: block;
      font-size: 16px;
      line-height: 2.5;
      padding: 0 10px;
      text-decoration: none;
      white-space: nowrap;
    }

    .tab__item.beefup {
      border-radius: 0;
      display: none;
      margin: 0;
    }

    .tab__item.beefup.is-open {
      display: block;
    }

    .tab__item .beefup__head {
      display: none;
    }

### Dropdown

    $('.dropdown').beefup({
        animation: 'fade',
        openSingle: true,
        selfClose: true
    });

    .dropdown__menu li {
      font-size: 16px;
    }

    .dropdown__menu a {
      clear: both;
      color: inherit;
      display: block;
      padding: 3px 10px;
      text-decoration: none;
      white-space: nowrap;
    }

    .dropdown__menu a:hover {
      background-color: #f5f5f5;
    }

    .dropdown.beefup {
      border: 0;
      border-radius: 0;
      display: inline-block;
      margin: 0;
      padding: 0;
      position: relative;
    }

    .dropdown.beefup.is-open .beefup__head::after {
      border-width: 0 4px 4px;
      border-color: transparent transparent #222;
    }

    .dropdown .beefup__head {
      background: #fff;
      border: 1px solid #ddd;
      border-radius: 4px;
      cursor: pointer;
      display: inline-block;
      font-size: 16px;
      font-weight: bold;
      line-height: 2.5;
      margin-bottom: 0;
      padding: 0 30px 0 10px;
      text-align: center;
      vertical-align: middle;
      white-space: nowrap;
    }

    .dropdown .beefup__head::after {
      border-style: solid;
      border-width: 4px 4px 0;
      border-color: #222 transparent transparent;
      margin-top: -2px;
      right: 10px;
    }

    .dropdown .beefup__body {
      position: absolute;
      top: 100%;
      left: 0;
      z-index: 1000;
      float: left;
      min-width: 160px;
      padding: 5px 0;
      margin: 2px 0 0;
      font-size: 14px;
      text-align: left;
      list-style: none;
      background-color: #fff;
      border: 1px solid #ddd;
      border-radius: 4px;
      box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175);
    }