image
image
image
image
image
image
image
image
<div id="directorio-cardclic-box" style="width:100%; overflow:visible; position:relative;">
  <iframe
    id="directorio-cardclic"
    src="https://cardclic.com/business-directory"
    style="width:100%; height:1600px; border:0; display:block;"
    loading="lazy">
  </iframe>
</div>

<script>
(function () {

  const iframe = document.getElementById("directorio-cardclic");
  const box = document.getElementById("directorio-cardclic-box");

  function ajustarAltura(doc) {

    setTimeout(function () {

      const alto = Math.max(
        doc.body.scrollHeight,
        doc.documentElement.scrollHeight
      );

      iframe.style.height = (alto + 50) + "px";
      box.style.height = (alto + 50) + "px";

    }, 800);

  }

  iframe.addEventListener("load", function () {

    let doc;

    try {
      doc = iframe.contentDocument || iframe.contentWindow.document;
    } catch (e) {
      console.log("No se pudo acceder al iframe");
      return;
    }

    /* OCULTAR TITULO DIRECTORIO */
    doc.querySelectorAll("h2").forEach(function(el){

      if(
        el.textContent.trim().toLowerCase()
        .includes("directorio de empresas")
      ){
        el.closest(".hero-section")?.remove();
      }

    });

    /* OCULTAR SUSCRIPCION */
    doc.querySelectorAll("footer").forEach(function(el){
      el.remove();
    });

    /* OCULTAR CURVA */
    doc.querySelectorAll(".curve-shape").forEach(function(el){
      el.remove();
    });

    /* OCULTAR OBJETOS FLOTANTES */
    doc.querySelectorAll(".vcard-object").forEach(function(el){
      el.style.display="none";
    });

    /* REDUCIR ESPACIO SUPERIOR */
    doc.querySelectorAll(".about-section").forEach(function(el){
      el.style.paddingTop="10px";
      el.style.marginTop="0";
    });

    ajustarAltura(doc);

    const observer = new MutationObserver(function(){
      ajustarAltura(doc);
    });

    observer.observe(doc.body,{
      childList:true,
      subtree:true
    });

  });

})();
</script>