mirror of
https://github.com/mrfluffy-dev/assignment.git
synced 2026-01-17 05:40:34 +00:00
initial commit
This commit is contained in:
20
public/pages/sidebar.js
Normal file
20
public/pages/sidebar.js
Normal file
@@ -0,0 +1,20 @@
|
||||
function toggleSidebar() {
|
||||
const sidebar = document.getElementById('sidebar');
|
||||
const toggleBtn = document.getElementById('toggle-btn');
|
||||
const content = document.getElementById('content');
|
||||
|
||||
sidebar.classList.toggle('collapsed');
|
||||
toggleBtn.classList.toggle('collapsed');
|
||||
content.classList.toggle('collapsed');
|
||||
}
|
||||
|
||||
function loadSidebar() {
|
||||
const xhr = new XMLHttpRequest();
|
||||
xhr.open('GET', '/pages/sidebar.html', true);
|
||||
xhr.onreadystatechange = function () {
|
||||
if (xhr.readyState === 4 && xhr.status === 200) {
|
||||
document.getElementById('sidebar').innerHTML = xhr.responseText;
|
||||
}
|
||||
};
|
||||
xhr.send();
|
||||
}
|
||||
Reference in New Issue
Block a user