-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscripts.js
47 lines (43 loc) · 1.33 KB
/
scripts.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// File: scripts.js
// Load the sidebar from the external file
function loadSidebar() {
fetch('sidebar.html')
.then(response => response.text())
.then(data => {
document.getElementById('sidebar').innerHTML = data;
})
.catch(error => {
console.error('Error loading sidebar:', error);
});
}
// Show image
function showImage(imageId) {
var img = document.getElementById(imageId);
img.style.display = 'block'; // Show the image
}
// Show or hide image, depending on the current state
function toggleShowImage(imageId) {
var img = document.getElementById(imageId);
if (img.style.display === 'none' || img.style.display === '') {
// Show the image
img.style.display = 'block';
} else {
// Hide the image
img.style.display = 'none';
}
}
// Zoom or unzoom image, depending on the current state
function zoomImage(img) {
// Check the current width to toggle between states
if (img.style.width === '100%' || img.style.width === '') {
// Zoom in
img.style.imageRendering = 'pixelated';
img.style.width = 'auto';
img.style.height = 'auto';
} else {
// Reset to original state
img.style.imageRendering = 'auto';
img.style.width = '100%';
img.style.height = 'auto';
}
}