{"id":842,"date":"2026-08-07T01:35:04","date_gmt":"2026-08-07T01:35:04","guid":{"rendered":"https:\/\/www.glitchlex.com\/jupiterx-codes\/gradient-text-js\/"},"modified":"2026-08-07T01:35:04","modified_gmt":"2026-08-07T01:35:04","slug":"gradient-text-js","status":"publish","type":"jupiterx-codes","link":"https:\/\/www.glitchlex.com\/es\/jupiterx-codes\/gradient-text-js\/","title":{"rendered":"Gradient Text &#8211; JS"},"content":{"rendered":"<p><script>\n(function () {\n  'use strict';<\/p>\n<p>  const TARGET_CLASS = 'glitch-gradient-text';<\/p>\n<p>  function initGradientText() {\n    const elements = document.querySelectorAll(`.${TARGET_CLASS}`);<\/p>\n<p>    \/\/ Desacoplamiento silencioso: si no existe la clase en la p\u00e1gina, se apaga sin errores\n    if (!elements || elements.length === 0) {\n      return;\n    }<\/p>\n<p>    \/\/ Restricci\u00f3n de rendimiento para m\u00f3viles \/ dispositivos de bajo consumo\n    const isLowPerformanceDevice = window.matchMedia('(max-width: 767px) and (prefers-reduced-motion: reduce)').matches;<\/p>\n<p>    elements.forEach(function (el) {\n      if (isLowPerformanceDevice) {\n        el.style.transform = 'none';\n      } else {\n        \/\/ Aceleraci\u00f3n por hardware dedicada para escritorio\n        el.style.willChange = 'background-image';\n      }\n    });\n  }<\/p>\n<p>  \/\/ Validador de carga recursivo para lidiar con carga diferida o minificaci\u00f3n\n  function checkAndRun(attempts) {\n    attempts = attempts || 0;\n    if (document.readyState === 'interactive' || document.readyState === 'complete') {\n      initGradientText();\n    } else if (attempts < 10) {\n      setTimeout(function () {\n        checkAndRun(attempts + 1);\n      }, 200);\n    }\n  }\n\n  if (document.readyState === 'loading') {\n    document.addEventListener('DOMContentLoaded', initGradientText);\n  } else {\n    checkAndRun(0);\n  }\n})();\n<\/script><\/p>","protected":false},"author":1,"template":"","meta":{"_acf_changed":false},"class_list":["post-842","jupiterx-codes","type-jupiterx-codes","status-publish","hentry"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.glitchlex.com\/es\/wp-json\/wp\/v2\/jupiterx-codes\/842","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.glitchlex.com\/es\/wp-json\/wp\/v2\/jupiterx-codes"}],"about":[{"href":"https:\/\/www.glitchlex.com\/es\/wp-json\/wp\/v2\/types\/jupiterx-codes"}],"author":[{"embeddable":true,"href":"https:\/\/www.glitchlex.com\/es\/wp-json\/wp\/v2\/users\/1"}],"wp:attachment":[{"href":"https:\/\/www.glitchlex.com\/es\/wp-json\/wp\/v2\/media?parent=842"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}