https://github.com/rah-emil/easy-toggler
Simple class switcher on web elements. JavaScript only.
https://github.com/rah-emil/easy-toggler
class dropdown easy-toggle easy-toggler js-lib tabs toggle toggle-class toggle-class-javascript toggle-switches
Last synced: 2 months ago
JSON representation
Simple class switcher on web elements. JavaScript only.
- Host: GitHub
- URL: https://github.com/rah-emil/easy-toggler
- Owner: rah-emil
- License: mit
- Created: 2020-07-31T08:33:55.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2023-07-19T19:41:41.000Z (almost 2 years ago)
- Last Synced: 2025-01-13T16:15:09.177Z (5 months ago)
- Topics: class, dropdown, easy-toggle, easy-toggler, js-lib, tabs, toggle, toggle-class, toggle-class-javascript, toggle-switches
- Language: JavaScript
- Homepage: https://rah-emil.ru/easy-toggler
- Size: 2.08 MB
- Stars: 44
- Watchers: 2
- Forks: 14
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# EasyToggler.js 🔗🚀


[](https://www.jsdelivr.com/package/npm/easy-toggler)


Simple class switcher on web elements. JavaScript only.

## Use a plugin instead of JavaScript
```htmlToggle class
Add class
Remove class
Removing a class if we click on an empty space
```## Import EasyToggler
### ES
```htmlimport easySetup from "easy-toggler";
easySetup({
// html attrs
toggle: 'easy-toggle',
add: 'easy-add',
remove: 'easy-remove',
class: 'easy-class',
rcoe: 'easy-rcoe',
parallel: 'easy-parallel',
self: 'easy-self',
selfRcoe: 'easy-self-rcoe',// Hooks
onToggle($el){},
onAdd($el){},
onRemove($el){},
onRcoe($el){},
});```
or easier:
```htmlimport easySetup from "easy-toggler";
easySetup();```
### CDN jsDelivr (iife)
```html```
### CJS
```htmlconst easySetup = require("easy-toggler");
easySetup({
// html attrs
toggle: 'easy-toggle',
add: 'easy-add',
remove: 'easy-remove',
class: 'easy-class',
rcoe: 'easy-rcoe',
parallel: 'easy-parallel',
self: 'easy-self',
selfRcoe: 'easy-self-rcoe',// Hooks
onToggle($el){},
onAdd($el){},
onRemove($el){},
onRcoe($el){},
});```
or easier:
```htmlconst easySetup = require("easy-toggler");
easySetup();```
## Demo
Visit demo page: [rah-emil.ru/easy-toggler](https://rah-emil.ru/easy-toggler)### Example â„–1
When you click the button, the class ```show``` will be added to ``````
```html
Menu
```
### Example â„–2
When you click the button, the class ```open``` will be added to ```