Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

119
Vistas
How can you point an HTML object's data attribute to an in-line SVG?

My site reuses the same 3 JS-animated clickable SVGs on each of a page's 63 post elements, and they seem to take forever to load/seriously hinder page performance. (Slow performance happens while using 3*63 separate HTML objects to pull in the same 3 external SVGs).

I'm trying to reduce my site's load time by only loading them once (either as an object w/ data attribute pointed to an external SVG file, or by loading them in the HTML as an in-line SVG), and then referencing their ID tag in an another object's data attribute, but this doesn't seem to work.

I made two example CodePens linked above to illustrate the issue, and copied the code from the external version below.

The end goal is just to reduce code (vs in-lining all 63*3 SVGs), and to improve performance/reduce loading times.

If I'm going about this the wrong way, please show me a better way to do this.

<object id="likeButton" type="image/svg+xml" data="https://www.charliemoody.com/s/likeButton.svg">
</object>

<object class="likeButtonClones" type="image/svg+xml" data="#likeButton">
</object>
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda