Get started with classie CDN
MIT licensed
Classie is a lightweight, feature-rich library for handling CSS transitions and animations in JS.
Tags:- class
Stable version
Copied!
How to start using classie CDN
<!DOCTYPE html>
<html>
<head>
<title>Get started with classie CDN - cdnhub.io</title>
<link rel="stylesheet" href="styles.css">
<script src="https://cdn.cdnhub.io/classie/1.0.1/classie.min.js"></script>
<script>
document.addEventListener('DOMContentLoaded', function() {
var toggleBtn = document.querySelector('.toggle');
var toggleBox = document.querySelector('.toggle-box');
function toggleClass(element, className) {
Classie.toggle(element, className);
}
toggleBtn.addEventListener('click', function() {
toggleClass(toggleBox, 'open');
});
});
</script>
</head>
<body>
<button class="toggle">Toggle</button>
<div class="toggle-box">
<p>This is a toggle box.</p>
</div>
</body>
</html>
Copied!
Copied!