nagasurendra commited on
Commit
f4aebef
·
verified ·
1 Parent(s): 349c9d0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -5
app.py CHANGED
@@ -383,9 +383,14 @@ def app():
383
  <script>
384
  function toggleCartModal(show) {
385
  const cartModal = document.getElementById('cart-modal');
386
- cartModal.style.display = show ? 'block' : 'none';
387
- cartModal.style.height = show ? '70%' : '50px';
388
- cartModal.style.position = 'fixed';
 
 
 
 
 
389
  }
390
 
391
  document.getElementById('view-cart-button').onclick = function() {
@@ -393,9 +398,10 @@ def app():
393
  };
394
 
395
  document.getElementById('close-cart').onclick = function() {
396
- toggleCartModal(false);
397
  };
398
- </script>
 
399
  """
400
  )
401
 
 
383
  <script>
384
  function toggleCartModal(show) {
385
  const cartModal = document.getElementById('cart-modal');
386
+ if (show) {
387
+ const screenHeight = window.innerHeight;
388
+ cartModal.style.display = 'block';
389
+ cartModal.style.height = Math.min(screenHeight * 0.7, 500) + 'px'; // Max 70% of screen or 500px
390
+ cartModal.style.position = 'fixed';
391
+ } else {
392
+ cartModal.style.display = 'none';
393
+ }
394
  }
395
 
396
  document.getElementById('view-cart-button').onclick = function() {
 
398
  };
399
 
400
  document.getElementById('close-cart').onclick = function() {
401
+ toggleCartModal(false);
402
  };
403
+ </script>
404
+
405
  """
406
  )
407