VOTUM Omni-Toggle is a simple AMD JavaScript module to toggle the visibility of one or multiple HTML elements.
You may use Bower to download the source and remove any unnecessary files:
bower install omni-toggle
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.
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.
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
VOTUM Omni-Toggle is released under the MIT License. See the bundled LICENSE file for details.