Barry8 commited on
Commit
32d23dc
·
verified ·
1 Parent(s): 97310a0

There seems to be box with something in it on the far tight, but I can't see it or do anything with it because it is not in the center and I can't close it

Browse files
Files changed (1) hide show
  1. index.html +22 -12
index.html CHANGED
@@ -25,17 +25,23 @@
25
  padding: 20px;
26
  }
27
  #sidebar {
28
- width: 0;
29
  position: fixed;
30
- right: 0;
31
  top: 0;
32
  height: 100%;
33
- overflow-x: hidden;
34
- transition: 0.5s;
35
  background-color: #f8f9fa;
36
  z-index: 1000;
 
 
 
 
 
 
37
  }
38
- #main {
39
  transition: margin-left .5s;
40
  }
41
  .tooltip {
@@ -200,9 +206,16 @@
200
  // Event listeners
201
  document.getElementById('addPairsBtn').addEventListener('click', addSelectedPairs);
202
  document.getElementById('clearPairsBtn').addEventListener('click', clearAllPairs);
203
- settingsBtn.addEventListener('click', openSidebar);
204
  closeSidebar.addEventListener('click', closeSidebar);
205
- darkModeToggle.addEventListener('click', function() {
 
 
 
 
 
 
 
206
  document.body.classList.toggle('dark-mode');
207
  const isDarkMode = document.body.classList.contains('dark-mode');
208
 
@@ -494,15 +507,12 @@ function subscribeToPair(pair) {
494
  }
495
  });
496
  }
497
-
498
  function openSidebar() {
499
- sidebar.style.width = '300px';
500
- document.getElementById('main').style.marginRight = '300px';
501
  }
502
 
503
  function closeSidebar() {
504
- sidebar.style.width = '0';
505
- document.getElementById('main').style.marginRight = '0';
506
  }
507
  function updateChartTheme(pair, isDarkMode) {
508
  charts[pair].chart.applyOptions({
 
25
  padding: 20px;
26
  }
27
  #sidebar {
28
+ width: 300px;
29
  position: fixed;
30
+ right: -300px;
31
  top: 0;
32
  height: 100%;
33
+ overflow-y: auto;
34
+ transition: right 0.5s ease;
35
  background-color: #f8f9fa;
36
  z-index: 1000;
37
+ padding: 20px;
38
+ box-shadow: -2px 0 5px rgba(0,0,0,0.1);
39
+ }
40
+
41
+ #sidebar.open {
42
+ right: 0;
43
  }
44
+ #main {
45
  transition: margin-left .5s;
46
  }
47
  .tooltip {
 
206
  // Event listeners
207
  document.getElementById('addPairsBtn').addEventListener('click', addSelectedPairs);
208
  document.getElementById('clearPairsBtn').addEventListener('click', clearAllPairs);
209
+ settingsBtn.addEventListener('click', openSidebar);
210
  closeSidebar.addEventListener('click', closeSidebar);
211
+
212
+ // Close sidebar when clicking outside
213
+ document.addEventListener('click', function(event) {
214
+ if (!sidebar.contains(event.target) && event.target !== settingsBtn) {
215
+ closeSidebar();
216
+ }
217
+ });
218
+ darkModeToggle.addEventListener('click', function() {
219
  document.body.classList.toggle('dark-mode');
220
  const isDarkMode = document.body.classList.contains('dark-mode');
221
 
 
507
  }
508
  });
509
  }
 
510
  function openSidebar() {
511
+ sidebar.classList.add('open');
 
512
  }
513
 
514
  function closeSidebar() {
515
+ sidebar.classList.remove('open');
 
516
  }
517
  function updateChartTheme(pair, isDarkMode) {
518
  charts[pair].chart.applyOptions({