Skip to content

A JavaScript module to toggle the visibility of one or multiple HTML elements.

License

Notifications You must be signed in to change notification settings

turbine-kreuzberg/omni-toggle

Repository files navigation

Build Status Code Climate

VOTUM Omni-Toggle

VOTUM Omni-Toggle is a simple AMD JavaScript module to toggle the visibility of one or multiple HTML elements.

Installation

You may use Bower to download the source and remove any unnecessary files:

bower install omni-toggle

Usage Example

In your website include Require.js and load the toggle script using AMD syntax:

<script src="bower_components/requirejs/require.js"></script>
<script>
requirejs.config( {
    baseUrl: 'bower_components/omni-toggle/src/'
} );

require( ['toggle'], function( Toggle ) {
    var toggleTrigger = document.querySelectorAll( '[data-toggle]' );
    var toggle = new Toggle();
    Toggle.initMultiple( toggleTrigger );
} );
</script>

For examples of the HTML markup to use, please take a look at the provided examples.

Development

To start making changes, simply run:

npm install

If you have changes that you think would contribute, we are happy to receive a pull request and will try to incorporate it as soon as possible. Please make sure that the current travis-ci tests are passing and that new functionality is covered by new tests as well.

Running the Tests

Our test are written with a combination of Mocha and should.js. To run the tests you can use the following npm commands:

npm test
npm run test-once

Additionally, to make sure you adhere to the coding style you should run ESLint:

npm run lint

License

VOTUM Omni-Toggle is released under the MIT License. See the bundled LICENSE file for details.

About

A JavaScript module to toggle the visibility of one or multiple HTML elements.

Resources

License

Stars

Watchers

Forks

Packages

No packages published