Hi @PYoganathan,
my personal go-to-solution for implementing animated SVGs in HubSpot is this:
- create a custom module(optional but recommended)
- insert a text-field(not rich-text) or URL option and an image option(for fallback;can be a text or URL field too) for the path to the SVG animation(can be file-manager or external; I prefer file-manager for performance)
- write the layout(see below)
- apply desired CSS styling to it(I would recommend to do it in the main CSS file or in a seperate file which you link in the module)
- save the module
- use the module
My layout code(feel free to modify it):
<div class="mySVGanimation">
<object type="image/svg+xml" data="image.svg">
<!-- Your fall back here -->
<img src="image.svg" alt="My fallback image for SVG if the animation is blocked by the browser" class="fallbackImage"/>
</object>
</div>
same code but with hubl:
<div class="mySVGanimation">
<object type="image/svg+xml" data="{{module.text_field}}"> {# if you decide to go with an URL field paste the value of it here instead of the text field #}
<!-- Your fall back here -->
<img src="{{ module.image_field.src }}" alt="{{ module.image_field.alt }}" class="fallbackImage"/>
</object>
</div>
Note: I didn’t change the names of the seperate fields.
The usage would be:
Drop the custom module into the place you’d like to use it, paste the URL to the SVG into the text or URL field, select a fallback image(can be jpg,png, svg - what ever you like but think about “old”/“not-mainstream” browsers which may not support SVGs) - done.
Also: 1.5MBytes for an SVG is really big and will most likely have a negative impact on the performace. Have you tried to recreate your SVG in something like SVGator?
Hope this helps,
best,
Anton