How to lazyload images in HubSpot

Lazy loading is getting HTML support in modern browsers. so you can add that attribute to your img tag

Unfortunately, this probably doesn’t cover all that you need so I would suggest adding a js backup. I think it is pretty clearly laid out in this post.

So for your image tag, it would look something like this:

now anytime you swap an image, it will update both the data-src and the src

Lazy loading requires you to add a js lib to your pages and modify a little the code of your images while editing it.– View source code and change the src with data-src and add the class lazy to your classes. here is an example

you can learn more here.

this is the lib I’m using

If this post helped you resolve your issue, please consider marking it as the solution. Thank you for supporting our HubSpot community.


Leave a Comment

Do you have any question or comment about article?


Related Posts

Scroll to Top