templates/components/products.html.twig line 1

Open in your IDE?
  1. <style>
  2.     
  3.     /* Estilo del texto con límite de 3 líneas */
  4.     .text-container {
  5.       display: -webkit-box;
  6.       -webkit-line-clamp: 3;
  7.       -webkit-box-orient: vertical;
  8.       overflow: hidden;
  9.       transition: max-height 0.5s ease;
  10.     }
  11.     /* Cuando está expandido, se muestra completo */
  12.     .expanded {
  13.       -webkit-line-clamp: unset;
  14.     }
  15.     /* Estilo del botón */
  16.     .toggle-btn {
  17.       cursor: pointer;
  18.       color: #007bff;
  19.       font-weight: bold;
  20.       text-align: center;
  21.       margin-top: 8px;
  22.       user-select: none;
  23.       display: inline-block;
  24.     }
  25.     /* Aumentar el ancho del tooltip */
  26.     .tooltip-inner {
  27.       max-width: 300px !important; /* Puedes cambiar este valor */
  28.       text-align: left;
  29.       white-space: normal;
  30.     }
  31.     .order-container .title-block{
  32.             top: 30px;
  33.             z-index: 1000;
  34.             background: #f8f9fa;
  35.     }
  36.     
  37. </style>
  38.   {% for product in products %}
  39.       {% include "components/products/product.html.twig" with {'product': product} %}
  40.   {% endfor %}
  41.             
  42.     
  43. <script>
  44.     $(document).ready(function() {
  45.         // Inicializar tooltips de Bootstrap
  46.         var tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'));
  47.         var tooltipList = tooltipTriggerList.map(function (tooltipTriggerEl) {
  48.             return new bootstrap.Tooltip(tooltipTriggerEl);
  49.         });
  50.         $(".toggle-btn").each(function() {
  51.             var fullText = $(this).prev(".text-container").text(); // Obtener el texto completo
  52.             $(this).attr("title", fullText); // Asignar el texto al tooltip
  53.         });
  54.     });
  55. </script>
  56.