1.0.1 • Published 7 years ago

@michaelkoelewijn/faq v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
7 years ago

Frequently Asked Questions

This package can be used to quickly create a FAQ module. Clicking on an FAQ-item will trigger one of the following events:

  • a jQuery slideToggle() of the answer (leaving the question visible)
  • A class toggle of the complete item itself. The rest is up to you.

Installing

npm install @michaelkoelewijn91/faq
yarn add @michaelkoelewijn91/faq

Usage

var Faq = require('@michaelkoelewijn91/faq');
$(() => {
    Faq.init({
        children: '.js-faq-item',
        question: '.js-faq-question',
        answer: '.js-faq-answer'
    })
})

Options

KeyValueDefaultDescription
childrenstring.js-faq-itemThese items will be toggleable
questionstring.js-faq-questionClicking on this element triggers the toggle event
answerstring.js-faq-answerThe event will target this element
togglestringslideUse slide for a jQuery slideToggle. Use class to set an active class on the value provided for the key children
1.0.1

7 years ago

1.0.0

7 years ago