Lazy Loading of content

Could you please tell me how I can implement Lazy Loading of content in Offcanvas using JS? Ajax? I want the offcanvas content to not be present in the HTML when the page loads, but to load this content when a trigger (e.g., a button) is clicked.

This will significantly reduce the HTML code and provide a huge benefit for SEO.


You could use Bricks’ popup template, which has AJAX built in.

Then the only thing needed would be to handle the animation and positioning to make it work more like an offcanvas would. sliding in etc.

(I don’t believe there’d be any benefit SEO wise though, especially if it’s just a menu inside your offcanvas)

I understand how to do this using a Popup, but how can I load content if it is just a div on the page or a shortcode with a template?

1 Like