Get started with easy-toggle-state CDN

MIT licensed

Design pattern for simple, efficient state toggle handling in components.

Tags:
  • toggle
  • switch
  • accessibility
  • ui components
  • dropdown
  • modal
  • tooltip
  • navigation button
  • lightbox
  • tabs
  • checkbox
  • radio

Stable version

Copied!

How to start using easy-toggle-state CDN


<!DOCTYPE html>
<html>
<head>
  <title>Get started with easy-toggle-state CDN - cdnhub.io</title>
  <link rel="stylesheet" href="styles.css">
  <script src="https://cdn.cdnhub.io/easy-toggle-state/1.16.0/easy-toggle-state.min.js"></script>
</head>
<body>
  <button class="toggle-button" data-toggle="#my-content">Toggle Content</button>
  <div id="my-content" style="display: none;">
    <p>This is the content that will be toggled.</p>
  </div>

  <script>
    document.addEventListener('DOMContentLoaded', () => {
      const toggleButton = document.querySelector('.toggle-button');
      const content = document.querySelector('#my-content');

      new EasyToggleState(toggleButton, content);
    });
  </script>
</body>
</html>
Copied!
Copied!
Copied!
Copied!

All versions