
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
easy-toggler
Advanced tools
Simple class switcher on web elements. JavaScript only.
<script type="module">
import 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){},
});
</script>
or easier:
<script type="module">
import easySetup from "easy-toggler";
easySetup();
</script>
<script src="https://cdn.jsdelivr.net/npm/easy-toggler@2.2.0/dist/easy-toggler.min.js"></script>
<script type="module">
const easySetup = require("easy-toggler.cjs");
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){},
});
</script>
or easier:
<script type="module">
import easySetup from "easy-toggler";
easySetup();
</script>
When you click the button, the class show
will be added to <nav id="main_menu">
<button easy-toggle="#main_menu" easy-class="show">Menu</button>
<nav id="main_menu">
<ul>
<li><a>Home</a></li>
<li><a>About us</a></li>
<li><a>Services</a></li>
<li><a>Portfolio</a></li>
<li><a>Contact us</a></li>
</ul>
</nav>
When you click the button, the class open
will be added to <div id="categories" class="dropdown-menu">
. When clicking outside the element area, class open
will be deleted from <div id="categories" class="dropdown-menu">
, since we specified the easy-rcoe
attribute for the link.
<div class="dropdown">
<a href="#" easy-toggle="#categories" easy-class="open" easy-rcoe>Categories</a>
<div id="categories" class="dropdown-menu">
<a href="#">HTML</a>
<a href="#">CSS</a>
<a href="#">JavaScript</a>
<a href="#">Vue.js</a>
<a href="#">Laravel</a>
</div>
</div>
EasyToggler.js only allows you to conveniently manage the element classes. CSS styles (behavior of elements with certain classes) must be specified independently.
The author will be grateful to all developers for any suggestions to improve the plugin. Fork and submit pull requests. Thank you!
2.2.0 (2022-07-15)
Closed issues:
Bugfix:
Implemented enhancements:
onToggle($el)
, onAdd($el)
, onRemove($el)
, onRcoe($el)
)FAQs
Simple class switcher on web elements. JavaScript only.
The npm package easy-toggler receives a total of 2 weekly downloads. As such, easy-toggler popularity was classified as not popular.
We found that easy-toggler demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.