rodrigohax

Personas visitando - liquid

Jul 28th, 2025
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 1.67 KB | None | 0 0
  1. <div class="viewer-count">
  2.   <span class="random-users-ball"></span>
  3.   <span id="viewerNumber">82</span>&nbsp;<b>personas</b>&nbsp;viendo este producto ahora!
  4. </div>
  5.  
  6. <style>
  7.   .viewer-count {
  8.     display: flex;
  9.     align-items: center;
  10.     font-size: 12px;
  11.     color: #202020;
  12.     background-color: #f6f6f6;
  13.     padding: 5px 10px;
  14.     border-radius: 8px;
  15.     width: fit-content;
  16.     box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  17.     border: 1px solid #E5E5E5;
  18.     border-bottom: 4px solid #ccc;
  19.   }
  20.  
  21.   .random-users-ball {
  22.     width: 12px;
  23.     height: 12px;
  24.     background-color: #ff0000;
  25.     border-radius: 50%;
  26.     box-shadow: 0 0 0 0 rgba(0, 0, 0, 1);
  27.     animation: pulse 2s infinite linear;
  28.     margin-right: 5px;
  29.   }
  30.  
  31.   @keyframes pulse {
  32.     0% {
  33.       transform: scale(0.95);
  34.       box-shadow: 0 0 0 0 rgba(0, 0, 0, 0.7);
  35.     }
  36.     70% {
  37.       transform: scale(1);
  38.       box-shadow: 0 0 0 10px rgba(0, 0, 0, 0);
  39.     }
  40.     100% {
  41.       transform: scale(0.95);
  42.       box-shadow: 0 0 0 0 rgba(0, 0, 0, 0);
  43.     }
  44.   }
  45. </style>
  46.  
  47. <script>
  48.   document.addEventListener('DOMContentLoaded', function () {
  49.     const viewerElement = document.getElementById('viewerNumber');
  50.  
  51.     // Valores que simulan los cambios del keyframe original
  52.     const viewerCounts = [95, 85, 90, 92, 98, 79, 81, 89, 97, 80];
  53.  
  54.     let index = 0;
  55.  
  56.     function updateViewerCount() {
  57.       viewerElement.textContent = viewerCounts[index];
  58.       index = (index + 1) % viewerCounts.length;
  59.  
  60.       // Cambia cada 2 segundos como una animación suave
  61.       setTimeout(updateViewerCount, 2000);
  62.     }
  63.  
  64.     updateViewerCount();
  65.   });
  66. </script>
Advertisement
Add Comment
Please, Sign In to add comment