mirror of
https://github.com/hastagAB/Awesome-Python-Scripts.git
synced 2024-11-30 23:41:08 +00:00
17 lines
540 B
JavaScript
17 lines
540 B
JavaScript
|
let sidebar = document.querySelector(".sidebar");
|
||
|
let closeBtn = document.querySelector("#btn");
|
||
|
|
||
|
closeBtn.addEventListener("click", ()=>{
|
||
|
sidebar.classList.toggle("open");
|
||
|
menuBtnChange();//calling the function(optional)
|
||
|
});
|
||
|
|
||
|
|
||
|
// following are the code to change sidebar button(optional)
|
||
|
function menuBtnChange() {
|
||
|
if(sidebar.classList.contains("open")){
|
||
|
closeBtn.classList.replace("bx-menu", "bx-menu-alt-right");//replacing the iocns class
|
||
|
}else {
|
||
|
closeBtn.classList.replace("bx-menu-alt-right","bx-menu");//replacing the iocns class
|
||
|
}
|
||
|
}
|