Usage / Activity

Essential

$
77
/ Year
Get started

Standard

$
99
/ Year
Get started
$
180
/ Year
Get started
$
180
/ Year
Get started
  • Here goes your text
  • Here goes your text with two lines simulate
  • Here goes your text with two lines simulate
  • Here goes your text with two lines simulate
  • Here goes your text with two lines simulate
  • Here goes your text with two lines simulate
  • Here goes your text with two lines simulate
  • Here goes your text with two lines simulate
  • Here goes your text with two lines simulate
  • Here goes your text with two lines simulate
  • Here goes your text with two lines simulate
<script>
  
 let isMobile = false;
let originalHtml = null;

function executeCodeOnMobile() {
  // Mover todos los elementos al principio
  const headerCols = document.querySelectorAll(".fb-pt-two__header .fb-pt-two__col");
  const bodyCols = document.querySelectorAll(".fb-pt-two__body .fb-pt-two__col");

  if (headerCols.length > 0 && bodyCols.length > 0) {
    headerCols.forEach((headerCol, index) => {
      const bodyCol = bodyCols[index];
      while (headerCol.firstChild) {
        bodyCol.insertBefore(headerCol.lastChild, bodyCol.firstChild);
      }
    });
  }

  // Igualar la altura del elemento '.fb-pt-two__heading' al primer elemento '.fb-pt-two__plan'
  const firstPlanElement = document.querySelector('.fb-pt-two__plan');
  const headingElement = document.querySelector('.fb-pt-two__heading');

  if (firstPlanElement && headingElement) {
    const planElementHeight = firstPlanElement.clientHeight;
    headingElement.style.height = planElementHeight + 'px';
  }

  // Duplicar el elemento con clase "fb-pt-two__col-list" en el cuerpo
  const fbBody = document.querySelector('.fb-pt-two__body');
  const elementToDuplicate = fbBody.querySelector('.fb-pt-two__col-list');

  if (elementToDuplicate) {
    const colElements = fbBody.querySelectorAll('.fb-pt-two__col');
    for (let i = 1; i < colElements.length - 1; i++) {
      const colElement = colElements[i];
      const clonedElement = elementToDuplicate.cloneNode(true);
      colElement.insertAdjacentElement('afterend', clonedElement);
    }
  }
}

function checkScreenSize() {
  const isMobileNow = window.matchMedia("(max-width: 767px)").matches;

  if (isMobileNow && !isMobile) {
    // Almacenar el estado actual del HTML en la variable originalHtml
    originalHtml = document.documentElement.innerHTML;
    isMobile = true;
    executeCodeOnMobile();
  } else if (!isMobileNow && isMobile) {
    // Restaurar el estado inicial del HTML
    document.documentElement.innerHTML = originalHtml;
    isMobile = false;
  }

  if (isMobileNow) {
    // Recalcular el alto de .fb-pt-two__plan
    const firstPlanElement = document.querySelector('.fb-pt-two__plan');
    const headingElement = document.querySelector('.fb-pt-two__heading');

    if (firstPlanElement && headingElement) {
      const planElementHeight = firstPlanElement.clientHeight;
      headingElement.style.height = planElementHeight + 'px';
    }
  }
}

// Ejecutar el código al cargar la página
document.addEventListener("DOMContentLoaded", checkScreenSize);

// Volver a ejecutar el código cuando se redimensione la pantalla
window.addEventListener("resize", checkScreenSize);

    
</script>