1. Install Jquery with npm
npm install jquery
2. Import & Letakkan Jquery pada komponen yang hendak digunakan
<script setup>
import $ from "jquery";
$(document).ready(function () {
// event will be executed when the toggle-button is clicked
document.getElementById("button-toggle").addEventListener("click", () => {
// when the button-toggle is clicked, it will add/remove the active-sidebar class
document.getElementById("sidebar").classList.toggle("active-sidebar");
// when the button-toggle is clicked, it will add/remove the active-main-content class
document
.getElementById("main-content")
.classList.toggle("active-main-content");
});
});
</script>
0 Komentar