// LEER MÁS jQuery(function () { // Seleccionamos todas las descripciones jQuery(".term-description").each(function () { var $termDesc = jQuery(this); var maxHeight = 200; // Altura inicial var totalHeight = $termDesc.prop("scrollHeight"); // Altura total del contenido var $readMoreLink = jQuery('
Leer más...
'); // Solo agregamos el enlace "Leer más" si el contenido supera el maxHeight if (totalHeight > maxHeight) { $termDesc.after($readMoreLink); // Insertar enlace después de la descripción } // Comportamiento del botón Leer más/Leer menos $readMoreLink.find(".read-more").on("click", function (e) { e.preventDefault(); if ($termDesc.hasClass("expanded")) { // Contraer el texto $termDesc.removeClass("expanded").animate({ maxHeight: maxHeight }, 400); jQuery(this).text("Leer más..."); } else { // Expandir el texto $termDesc.addClass("expanded").animate({ maxHeight: totalHeight }, 400); jQuery(this).text("Leer menos..."); } }); }); }); jQuery(function () { // Seleccionamos todas las descripciones jQuery(".brand-description").each(function () { var $termDesc = jQuery(this); var maxHeight = 100; // Altura inicial var totalHeight = $termDesc.prop("scrollHeight"); // Altura total del contenido var $readMoreLink = jQuery('
Leer más...
'); // Solo agregamos el enlace "Leer más" si el contenido supera el maxHeight if (totalHeight > maxHeight) { $termDesc.after($readMoreLink); // Insertar enlace después de la descripción } // Comportamiento del botón Leer más/Leer menos $readMoreLink.find(".read-more").on("click", function (e) { e.preventDefault(); if ($termDesc.hasClass("expanded")) { // Contraer el texto $termDesc.removeClass("expanded").animate({ maxHeight: maxHeight }, 400); jQuery(this).text("Leer más..."); } else { // Expandir el texto $termDesc.addClass("expanded").animate({ maxHeight: totalHeight }, 400); jQuery(this).text("Leer menos..."); } }); }); }); // AJUSTAR EL TAMAÑO DEL TITULO DEL PRODUCTO EN FUNCIÓN DEL NÚMERO DE CARACTERES jQuery(document).on('yith_infs_added_elem', function() { jQuery('.woocommerce-loop-product__title').each(function(){ quote = jQuery(this); var numWords = quote.text().length; if ((numWords >= 1) && (numWords < 45)) { quote.css("font-size", "0.77em"); } else if ((numWords >= 45) && (numWords < 90)) { quote.css("font-size", "0.72em"); } else { quote.css("font-size", "1em"); } }); jQuery('.products li input.qty ').on('change', function() { jQuery(this).parent().next('a').data('quantity', this.value); jQuery(this).parent().next('a').attr('data-quantity', this.value); }); }); // COMPORTAMIENTO DE LAS PESTAÑAS DEL HEADER SEGUN EL ROL LOGEADO jQuery(document).ready(function ($) { // Desactivar botones según el rol del usuario if ($('body').hasClass('role-customer')) { // Si el usuario es "customer", desactivar el botón profesional $('#profesional').attr('href', '#').css('opacity', '0.5').addClass('disabled'); } else if ($('body').hasClass('role-profesional')) { // Si el usuario es "profesional", desactivar el botón particular $('#particular').attr('href', '#').css('opacity', '0.5').addClass('disabled'); } // Cambiar opacidad según la URL actual var currentPath = window.location.pathname; if (currentPath === '/registro-profesional/') { $('#particular').css('opacity', '0.5'); } else if (currentPath === '/registro-particular/') { $('#profesional').css('opacity', '0.5'); } });