orxapi.tools.toggle
v2.0.0
Published
The TypeScript toggle tools library for orxapi
Downloads
214
Maintainers
Readme
orxapi.tools.toggle
The toggle tools library for orxapi.
Getting Started
If you haven't used NodeJs before, be sure to have install the LTS version on your desktop ! Check your version with this command:
node -v
v14.15.0
Installation
npm install orxapi.tools.toggle --save-dev
This library is written in TypeScript, but you can use JavaScript.
Usage
TypeScript code
import { toggleLink } from "orxapi.tools.toggle";
// Click event: display the content information
$(".link").on("click.toggleLink", (evt: JQueryEventObject) => {
const elem = evt.currentTarget;
toggleLink(elem);
});
HTML code
<button class="link" data-toggle-link="contentInformation">More information</button>
<div id="contentInformation" class="content">
...
</div>
Methods
- toggleLink Toggle link from data id
- toggleLinks Toggle links from data id
- toggleSwitch Toggle switch between two links
- toggleText Toggle text from data text
- toggleIcon Toggle switch between two icons data values
- toggleDisabled Toggle disable all list element from data disabled
See docs for more information
This library was designed to work with ES 6+
TODO
- [ ] Add tests
- [ ] Improve the documentation